﻿/*
*######################################
* eWebEditor v7.0 - Advanced online web based WYSIWYG HTML editor.
* Copyright (c) 2003-2011 eWebSoft.com
*
* For further information go to http://www.ewebeditor.net/
* This copyright notice MUST stay intact for use.
*######################################
*/

String.prototype.fe = function(s) {
    return (this.indexOf(s) > -1);
};
String.prototype.wK = function(s) {
    return (this.substr(0, s.length) == s);
};
String.prototype.kz = function(s, ignoreCase) {
    var lZ = this.length;
    var gh = s.length;
    if (gh > lZ) {
        return false;
    }
    if (ignoreCase) {
        var pf = new RegExp(s + '$', 'i');
        return pf.test(this);
    } else {
        return (gh == 0 || this.substr(lZ - gh, gh) == s);
    }
};
String.prototype.lp = function() {
    return this.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '');
};
Array.prototype.eB = function(s) {
    for (var i = 0; i < this.length; i++) {
        if (this[i] == s) {
            return i;
        }
    }
    return - 1;
}; (function() {
    var qS = /()??/.exec("")[1] === undefined;
    var kq = function() {
        var x = /^/g;
        x.test("");
        return ! x.lastIndex;
    } ();
    var ev = {
        exec: RegExp.prototype.exec,
        match: String.prototype.match,
        replace: String.prototype.replace,
        split: String.prototype.split,
        test: RegExp.prototype.test
    };
    var rh = function(kI, item, qg) {
        for (var i = qg || 0; i < kI.length; i++) {
            if (kI[i] === item) {
                return i;
            }
        }
        return - 1;
    };
    var rm = function(bN) {
        return (bN.global ? "g": "") + (bN.ignoreCase ? "i": "") + (bN.multiline ? "m": "") + (bN.extended ? "x": "") + (bN.sticky ? "y": "");
    };
    var mh = function(o) {
        return Object.prototype.toString.call(o) === "[object RegExp]";
    };
    RegExp.prototype.exec = function(T) {
        var match = ev.exec.apply(this, arguments),
        name,
        kB;
        if (match) {
            if (!qS && match.length > 1 && rh(match, "") > -1) {
                kB = RegExp("^" + this.source + "$(?!\\s)", rm(this));
                ev.replace.call(match[0], kB,
                function() {
                    for (var i = 1; i < arguments.length - 2; i++) {
                        if (arguments[i] === undefined) {
                            match[i] = undefined;
                        }
                    }
                });
            }
            if (!kq && this.global && this.lastIndex > (match.index + match[0].length)) {
                this.lastIndex--;
            }
        }
        return match;
    };
    if (!kq) {
        RegExp.prototype.test = function(T) {
            var match = ev.exec.call(this, T);
            if (match && this.global && this.lastIndex > (match.index + match[0].length)) {
                this.lastIndex--;
            }
            return ! !match;
        };
    }
    String.prototype.match = function(bN) {
        if (!mh(bN)) {
            bN = RegExp(bN);
        }
        if (bN.global) {
            var result = ev.match.apply(this, arguments);
            bN.lastIndex = 0;
            return result;
        }
        return bN.exec(this);
    };
    String.prototype.split = function(s, cR) {
        if (!mh(s)) {
            return ev.split.apply(this, arguments);
        }
        var T = this + "",
        dh = [],
        fg = 0,
        match,
        mn;
        if (cR === undefined || +cR < 0) {
            cR = Infinity;
        } else {
            cR = Math.floor( + cR);
            if (!cR) {
                return [];
            }
        }
        while (match = s.exec(T)) {
            if (s.lastIndex > fg) {
                dh.push(T.slice(fg, match.index));
                if (match.length > 1 && match.index < T.length) {
                    Array.prototype.push.apply(dh, match.slice(1));
                }
                mn = match[0].length;
                fg = s.lastIndex;
                if (dh.length >= cR) {
                    break;
                }
            }
            if (!match[0].length) {
                s.lastIndex++;
            }
        }
        if (fg === T.length) {
            if (!ev.test.call(s, "") || mn) {
                dh.push("");
            }
        } else {
            dh.push(T.slice(fg));
        }
        return dh.length > cR ? dh.slice(0, cR) : dh;
    };
})();
var ag = (function() {
    var bV = new Object();
    var hn = document.location.search.substr(1).split("&");
    for (i = 0; i < hn.length; i++) {
        var hh = hn[i].split("=");
        bV[hh[0]] = hh[1];
    }
    var by = function(aF, oa) {
        return (bV[aF]) ? bV[aF] : oa;
    };
    return {
        bj: by("id", ""),
        rC: by("originalfilename", ""),
        rB: by("savefilename", ""),
        rz: by("savepathfilename", ""),
        ExtCSS: by("extcss", ""),
        qj: by("fullscreen", ""),
        StyleName: by("style", "coolblue"),
        CusDir: by("cusdir", ""),
        Skin: by("skin", ""),
        FixWidth: by("fixwidth", ""),
        Lang: by("lang", ""),
        AreaCssMode: by("areacssmode", ""),
        ReadOnly: by("readonly", ""),
        SKey: by("skey", "")
    };
})();
var O = (function() {
    var s = navigator.userAgent.toLowerCase();
    var kD = (
    /*@cc_on!@*/
    false);
    var eT = 0;
    if (kD) {
        eT = parseInt(s.match(/msie (\d+)/)[1], 10);
    }
    return {
        ae: kD,
        tg: (eT == 6),
        uO: (eT >= 6),
        gM: (eT >= 7),
        uw: (eT >= 8),
        jx: s.fe('gecko/'),
        hg: s.fe('safari'),
        hW: !!window.opera,
        uK: s.fe(' adobeair/'),
        uz: s.fe('macintosh'),
        uJ: s.fe('chrome/'),
        hU: true
    };
})();
var lang = new Object();
lang.iU = {
    "da": true,
    "de": true,
    "en": true,
    "fr": true,
    "it": true,
    "es": true,
    "ja": true,
    "nl": true,
    "no": true,
    "pt": true,
    "ru": true,
    "sv": true,
    "zh-cn": true,
    "zh-tw": true
};
lang.pL = function() {
    if (ag.Lang) {
        return ag.Lang;
    }
    if (config.AutoDetectLanguage == "1") {
        var cS;
        if (navigator.userLanguage) {
            cS = navigator.userLanguage.toLowerCase();
        } else if (navigator.language) {
            cS = navigator.language.toLowerCase();
        } else {
            return this.DefaultLanguage;
        }
        if (this.iU[cS]) {
            return cS;
        } else if (cS.length > 2) {
            cS = cS.substr(0, 2);
            if (this.iU[cS]) {
                return cS;
            }
        }
    }
    return this.DefaultLanguage;
};
lang.TranslatePage = function(eN) {
    var gs = eN.getElementsByTagName("INPUT");
    for (i = 0; i < gs.length; i++) {
        if (gs[i].getAttribute("lang")) {
            gs[i].value = lang[gs[i].getAttribute("lang")];
        }
    }
    var ge = eN.getElementsByTagName("SPAN");
    for (i = 0; i < ge.length; i++) {
        if (ge[i].getAttribute("lang")) {
            ge[i].innerHTML = lang[ge[i].getAttribute("lang")];
        }
    }
    var gc = eN.getElementsByTagName("OPTION");
    for (i = 0; i < gc.length; i++) {
        if (gc[i].getAttribute("lang")) {
            gc[i].innerHTML = lang[gc[i].getAttribute("lang")];
        }
    }
};
lang.Init = function() {
    if (this.iU[config.DefaultLanguage]) {
        this.DefaultLanguage = config.DefaultLanguage;
    } else {
        this.DefaultLanguage = "en";
    }
    this.ax = this.pL();
};
var xD = (function() {
    var tm = 9999;
    var aZ, dA, bZ;
    var mf, ab, hT, hS;
    var aJ = {
        x: 0,
        y: 0,
        cY: 0,
        rel: null
    };
    var tY;
    var fc;
    var fJ = false;
    var bI;
    var lV = function() {
        if (aZ) {
            return;
        }
        hT = "<table border=0 cellpadding=0 cellspacing=0 class='Menu_Box' id=Menu_Box><tr><td class='Menu_Box'><table border=0 cellpadding=0 cellspacing=0 class='Menu_Table'>";
        ab = "<tr><td class='Menu_Sep'><table border=0 cellpadding=0 cellspacing=0 class='Menu_Sep'><tr><td></td></tr></table></td></tr>";
        hS = "</table></td></tr></table>";
        mf = "<html><head>" + "<link href='" + A.bF + "/language/" + lang.ax + ".css' type='text/css' rel='stylesheet'>" + "<link href='" + A.bF + "/skin/" + config.Skin + "/menuarea.css' type='text/css' rel='stylesheet'>" + "</head>" + "<body scroll='no'>";
        bI = C.nA();
        var tL = bI.document;
        bZ = tL.createElement('iframe');
        C.iv(bZ);
        bZ.src = 'javascript:void(0)';
        bZ.allowTransparency = true;
        bZ.frameBorder = '0';
        bZ.scrolling = 'no';
        bZ.style.width = bZ.style.height = '0px';
        C.dW(bZ, {
            position: 'absolute',
            zIndex: tm
        });
        bZ.kh = window;
        tL.body.appendChild(bZ);
        var pm = bZ.contentWindow;
        aZ = pm.document;
        aZ.open();
        aZ.write(mf);
        aZ.close();
        tY = C.fj(aZ);
        C.DisableSelection(aZ.body);
        C.ao(pm, 'focus', rO);
        C.ao(pm, 'blur', rQ);
        fc = aZ.body.appendChild(aZ.createElement('DIV'));
        fc.style.cssFloat = 'left';
        C.ao(aZ, 'contextmenu', C.aR);
        C.ao(aZ, 'dragstart', C.aR);
        C.ao(aZ, 'selectstart', C.aR);
        C.ao(aZ, 'select', C.aR);
    };
    var cQ = function(ac, nV, fZ, f) {
        var df = "";
        var mj;
        mj = "var w=frameElement.kh;w." + nV + ";w.xD.Hide();";
        if (ac == "") {
            df += "<tr><td class='Menu_Item'><table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td valign=middle class=MouseOut onMouseOver=\"this.className='MouseOver'\" onMouseOut=\"this.className='MouseOut'\" onclick=\"" + mj + "\">";
        } else {
            df += "<tr><td class='Menu_Item'><table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td valign=middle class=MouseDisabled>";
        }
        ac = (ac) ? "_Disabled": "";
        df += "<table border=0 cellpadding=0 cellspacing=0><tr><td class=Menu_Image_TD>";
        if (typeof(fZ) == "number") {
            var bA = "skin/" + config.Skin + "/buttons.gif";
            var cP = 16 - fZ * 16;
            df += "<div class='Menu_Image" + ac + "'><img src='" + bA + "' style='top:" + cP + "px'></div>";
        } else if (fZ != "") {
            var bA = "skin/" + config.Skin + "/" + fZ;
            df += "<img class='Menu_Image" + ac + "' src='" + bA + "'>";
        }
        df += "</td><td class='Menu_Label" + ac + "'>" + f + "</td></tr></table>";
        df += "</td></tr></table></td><\/tr>";
        return df;
    };
    var G = function(ac, az, dy) {
        var cs = Buttons[az];
        if (!dy) {
            dy = lang[az];
        } else {
            dy = lang[dy];
        }
        return cQ(ac, cs[1], cs[0], dy);
    };
    var af = function(az, bC) {
        var ac = "";
        if (!bC) {
            bC = az;
        }
        try {
            if (!A.F.queryCommandEnabled(bC)) {
                ac = "disabled";
            }
        } catch(e) {}
        return G(ac, az);
    };
    var en = function(dc) {
        var B = "";
        var ac = "disabled";
        switch (dc) {
        case "TableInsert":
            if (!xC.gE()) {
                ac = "";
            }
            B += G(ac, "TableInsert");
            break;
        case "TableProp":
            if (xC.gE() || xC.be()) {
                ac = "";
            }
            B += G(ac, "TableProp");
            break;
        case "TableCell":
            if (xC.be()) {
                ac = "";
            }
            B += G(ac, "TableCellProp");
            B += G(ac, "TableCellSplit");
            B += ab;
            B += G(ac, "TableRowProp");
            B += G(ac, "TableRowInsertAbove");
            B += G(ac, "TableRowInsertBelow");
            B += G(ac, "TableRowMerge");
            B += G(ac, "TableRowSplit");
            B += G(ac, "TableRowDelete");
            B += ab;
            B += G(ac, "TableColInsertLeft");
            B += G(ac, "TableColInsertRight");
            B += G(ac, "TableColMerge");
            B += G(ac, "TableColSplit");
            B += G(ac, "TableColDelete");
            break;
        }
        return B;
    };
    var qZ = function() {
        if (I.ay() == "Control") {
            return "";
        }
        var v = "";
        var iK = I.dm();
        if (!iK) {
            return "";
        }
        var dG = I.bH().getRangeAt(0);
        var iL = A.F.createRange();
        r = C.cG(iK, "font-size");
        var K = iK.getElementsByTagName("*");
        for (var i = 0; i < K.length; i++) {
            var t = K[i];
            iL.selectNodeContents(t);
            if ((iL.compareBoundaryPoints(Range.START_TO_END, dG) >= 0) && (iL.compareBoundaryPoints(Range.END_TO_START, dG) <= 0)) {
                var v = C.cG(t, "font-size");
                if (r != v) {
                    r = "";
                    break;
                }
            }
        }
        return v;
    };
    var ma = function(ai, ct, gI) {
        if (I.ay() == "Control") {
            if (ai) {
                var t = I.aX();
                if (t.tagName.toUpperCase() == ai) {
                    if ((ct) && (gI)) {
                        if (t.getAttribute(ct, 2).toLowerCase() == gI.toLowerCase()) {
                            return true;
                        }
                    } else {
                        return true;
                    }
                }
            } else {
                return true;
            }
        }
        return false;
    };
    tM = function() {
        if (aZ.readyState != "complete") {
            return false;
        }
        if (aZ.images) {
            for (var i = 0; i < aZ.images.length; i++) {
                var img = aZ.images[i];
                if (!img.complete) {
                    return false;
                }
            }
        }
        return true;
    };
    return {
        Show: function() {
            var w = fc.offsetWidth;
            var h = fc.offsetHeight;
            var x = aJ.x;
            var y = aJ.y;
            if (aZ.readyState != "complete") {
                window.setTimeout("xD.Show()", 50);
                return;
            }
            C.dW(bZ, {
                width: w + 'px',
                height: h + 'px',
                left: x + 'px',
                top: y + 'px'
            });
            fJ = true;
        },
        ShowToolMenu: function(e, an) {
            if (A.av != "EDIT") {
                return C.aR(e);
            }
            lV();
            if (fJ) {
                this.Hide();
            }
            var B = "";
            switch (an) {
            case "font":
                B += af("Bold");
                B += af("Italic");
                B += af("UnderLine");
                B += af("StrikeThrough");
                B += ab;
                B += af("SuperScript");
                B += af("SubScript");
                B += ab;
                B += G("", "UpperCase");
                B += G("", "LowerCase");
                B += ab;
                B += G("", "ForeColor");
                B += G("", "BackColor");
                B += ab;
                B += G("", "Big");
                B += G("", "Small");
                break;
            case "paragraph":
                B += af("JustifyLeft");
                B += af("JustifyCenter");
                B += af("JustifyRight");
                B += af("JustifyFull");
                B += ab;
                B += af("OrderedList", "insertorderedlist");
                B += af("UnOrderedList", "insertunorderedlist");
                B += af("Indent");
                B += af("Outdent");
                B += ab;
                B += af("Paragraph", "insertparagraph");
                B += G("", "BR");
                B += ab;
                B += G((hV()) ? "": "disabled", "ParagraphAttr", "CMenuParagraph");
                break;
            case "edit":
                var ac = "";
                if (!xB.pi()) {
                    ac = "disabled";
                }
                B += G(ac, "UnDo");
                if (!xB.ph()) {
                    ac = "disabled";
                }
                B += G(ac, "ReDo");
                B += ab;
                B += af("Cut");
                B += af("Copy");
                B += G("", "Paste");
                B += G("", "PasteText");
                B += G("", "PasteWord");
                B += ab;
                B += af("Delete");
                B += af("RemoveFormat");
                B += ab;
                B += af("SelectAll");
                B += af("UnSelect");
                B += ab;
                B += G("", "FindReplace");
                B += G("", "QuickFormat");
                break;
            case "object":
                B += G("", "BgColor");
                B += G("", "BackImage");
                B += ab;
                B += G("", "absolutePosition");
                B += G("", "zIndexForward");
                B += G("", "zIndexBackward");
                B += ab;
                B += G("", "ShowBorders");
                B += ab;
                B += G("", "Quote");
                B += G("", "Code");
                break;
            case "component":
                B += G("", "Image");
                B += G("", "Flash");
                B += G("", "Media");
                B += G("", "File");
                B += ab;
                B += G("", "RemoteUpload");
                B += G("", "LocalUpload");
                B += ab;
                B += G("", "Fieldset");
                B += G("", "Iframe");
                B += af("HorizontalRule", "InsertHorizontalRule");
                B += G("", "Marquee");
                B += ab;
                B += G("", "CreateLink");
                B += G("", "Anchor");
                B += G("", "Map");
                B += af("Unlink");
                break;
            case "tool":
                B += G("", "Template");
                B += G("", "Symbol");
                B += G("", "Excel");
                B += G("", "Emot");
                B += ab;
                B += G("", "EQ");
                B += G("", "Art");
                B += ab;
                B += G("", "NowDate");
                B += G("", "NowTime");
                B += ab;
                B += G("", "ImportWord");
                B += G("", "ImportExcel");
                B += G("", "Capture");
                B += ab;
                B += G("", "Pagination");
                B += G("", "PaginationInsert");
                break;
            case "file":
                B += G("", "Refresh");
                B += ab;
                B += G("", "ModeCode");
                B += G("", "ModeEdit");
                B += G("", "ModeText");
                B += G("", "ModeView");
                B += ab;
                B += G("", "SizePlus");
                B += G("", "SizeMinus");
                B += ab;
                B += G("", "Print");
                B += ab;
                B += G("", "About");
                B += G("", "Site");
                height = 208;
                break;
            case "table":
                B += en("TableInsert");
                B += en("TableProp");
                B += ab;
                B += en("TableCell");
                break;
            case "form":
                B += af("FormText", "InsertInputText");
                B += af("FormTextArea", "InsertTextArea");
                B += af("FormRadio", "InsertInputRadio");
                B += af("FormCheckbox", "InsertInputCheckbox");
                B += af("FormDropdown", "InsertSelectDropdown");
                B += af("FormButton", "InsertButton");
                break;
            case "gallery":
                B += G("", "GalleryImage");
                B += G("", "GalleryFlash");
                B += G("", "GalleryMedia");
                B += G("", "GalleryFile");
                break;
            case "zoom":
                for (var i = 0; i < xE.Options.length; i++) {
                    if (xE.Options[i] == xE.kj) {
                        B += cQ("", "xE.Execute(" + xE.Options[i] + ")", 120, xE.Options[i] + "%");
                    } else {
                        B += cQ("", "xE.Execute(" + xE.Options[i] + ")", 119, xE.Options[i] + "%");
                    }
                }
                break;
            case "fontsize":
                var v = qZ();
                for (var i = 0; i < lang["FontSizeItem"].length; i++) {
                    if (lang["FontSizeItem"][i][0] == v) {
                        B += cQ("", "formatFont('size','" + lang["FontSizeItem"][i][0] + "')", 120, lang["FontSizeItem"][i][1]);
                    } else {
                        B += cQ("", "formatFont('size','" + lang["FontSizeItem"][i][0] + "')", 119, lang["FontSizeItem"][i][1]);
                    }
                }
                break;
            case "fontname":
                var v = A.F.queryCommandValue("FontName");
                for (var i = 0; i < lang["FontNameItem"].length; i++) {
                    if (lang["FontNameItem"][i] == v) {
                        B += cQ("", "formatFont('face','" + lang["FontNameItem"][i] + "')", 120, lang["FontNameItem"][i]);
                    } else {
                        B += cQ("", "formatFont('face','" + lang["FontNameItem"][i] + "')", 119, lang["FontNameItem"][i]);
                    }
                }
                break;
            case "formatblock":
                var v = A.F.queryCommandValue("FormatBlock");
                if (v) {
                    v = v.toLowerCase();
                } else {
                    v = "";
                }
                for (var i = 0; i < lang["FormatBlockItem"].length; i++) {
                    if (lang["FormatBlockItem"][i][0].toLowerCase() == v) {
                        B += cQ("", "format('FormatBlock','" + lang["FormatBlockItem"][i][0] + "')", 120, lang["FormatBlockItem"][i][1]);
                    } else {
                        B += cQ("", "format('FormatBlock','" + lang["FormatBlockItem"][i][0] + "')", 119, lang["FormatBlockItem"][i][1]);
                    }
                }
                break;
            }
            fc.innerHTML = hT + B + hS;
            if (dA) {
                dA.show(0, 0, 0, 0, document.body);
                e = window.event;
                e.returnValue = false;
                var t = e.srcElement;
                var x = e.clientX - e.offsetX;
                var y = e.clientY - e.offsetY;
                if (t.style.top) {
                    y = y - parseInt(t.style.top);
                }
                if (t.tagName.toLowerCase() == "img") {
                    t = t.parentNode;
                    x = x - t.offsetLeft - t.clientLeft;
                    y = y - t.offsetTop - t.clientTop;
                }
                if (t.className == "TB_Btn_Image") {
                    t = t.parentNode;
                    x = x - t.offsetLeft - t.clientLeft;
                    y = y - t.offsetTop - t.clientTop;
                }
                y = y + t.offsetHeight;
                var cY = parseInt(t.offsetWidth);
                aJ.x = x;
                aJ.y = y;
                aJ.cY = cY;
                aJ.rel = document.body;
                xD.Show();
            } else {
                var t = e.target;
                if (t.tagName.toLowerCase() == "img" || t.className == "TB_Btn_Image") {
                    t = t.parentNode;
                }
                var x = 0;
                var y = 0;
                var cY = t.offsetWidth;
                var ff = t;
                if (O.hg) {
                    x = e.clientX;
                    y = e.clientY;
                } else {
                    x = e.pageX;
                    y = e.pageY;
                }
                var dM = C.gG(bI, t);
                x = dM.x;
                y = dM.y + t.offsetHeight;
                aJ.x = x;
                aJ.y = y;
                aJ.cY = cY;
                bZ.contentWindow.focus();
                window.setTimeout("xD.Show()", 1);
            }
        },
        qr: function(e) {
            if (A.av != "EDIT") {
                return C.aR(e);
            }
            lV();
            if (fJ) {
                xD.Hide();
            }
            var B = "";
            B += af("Cut");
            B += af("Copy");
            B += G("", "Paste");
            B += af("Delete");
            B += af("SelectAll");
            B += ab;
            if (xC.be()) {
                B += en("TableProp");
                B += en("TableCell");
                B += ab;
            }
            if (ma("TABLE")) {
                B += en("TableProp");
                B += ab;
            }
            if (ma("IMG")) {
                var bT = M.pq();
                if (!bT) {
                    B += G("", "Image", "CMenuImg");
                    B += ab;
                    B += G("", "zIndexForward");
                    B += G("", "zIndexBackward");
                    B += ab;
                }
                if (bT == "flash") {
                    B += G("", "Flash", "CMenuFlash");
                    B += ab;
                }
                if (bT == "mediaplayer6" || bT == "mediaplayer7" || bT == "realplayer" || bT == "quicktime" || bT == "flv") {
                    B += G("", "Media", "CMenuMedia");
                    B += ab;
                }
            }
            if (hV()) {
                B += G("", "ParagraphAttr", "CMenuParagraph");
                B += ab;
            }
            B += G("", "FindReplace");
            fc.innerHTML = hT + B + hS;
            if (dA) {
                dA.show(0, 0, 0, 0, document.body);
                e = eWebEditor.event;
                aJ.x = e.clientX;
                aJ.y = e.clientY;
                aJ.cY = 0;
                aJ.rel = A.F.body;
                xD.Show();
            } else {
                C.aR(e);
                aJ.x = e.pageX;
                aJ.y = e.pageY;
                var t = A.F;
                var dM = C.gG(bI, (C.fj(t) ? t.documentElement: t.body));
                aJ.x += dM.x;
                aJ.y += dM.y;
                aJ.cY = 0;
                bZ.contentWindow.focus();
                window.setTimeout("xD.Show()", 1);
            }
            return false;
        },
        Hide: function() {
            if (dA) {
                dA.hide();
            } else {
                if (!fJ) {
                    return;
                }
                bZ.style.width = bZ.style.height = '0px';
                fJ = false;
            }
        }
    };
})();
function rO(e) {};
function rQ(e) {
    xD.Hide();
};
var cZ = (function() {
    var dJ;
    var oD = 9999;
    var cf;
    var gV;
    var bI;
    var cd;
    var hJ = function() {
        return++oD;
    };
    var kl = function() {
        if (!cf) {
            return;
        }
        var ff = C.fj(cd) ? cd.documentElement: cd.body;
        C.dW(cf, {
            'width': Math.max(ff.scrollWidth, ff.clientWidth, cd.scrollWidth || 0) - 1 + 'px',
            'height': Math.max(ff.scrollHeight, ff.clientHeight, cd.scrollHeight || 0) - 1 + 'px'
        });
    };
    var jY = function(t) {
        C.dW(t, {
            'zIndex': hJ()
        });
    };
    var rp = function() {
        if (!bI) {
            bI = C.nA();
            cd = bI.document;
        }
        cf = cd.createElement("div");
        C.iv(cf);
        C.dW(cf, {
            "position": "absolute",
            "zIndex": hJ(),
            "top": "0px",
            "left": "0px",
            "backgroundColor": "#ffffff"
        });
        C.oC(cf, 0.50);
        C.ao(bI, "resize", kl);
        kl();
        cd.body.appendChild(cf);
    };
    var ri = function() {
        C.cW(cf);
    };
    return {
        OpenDialog: function(qK) {
            if (!dJ) {
                rp();
            } else {
                jY(cf);
            }
            var qL = {
                rR: bI,
                bi: window,
                Page: qK
            };
            I.Save(true);
            var es = 160;
            var cT = 100;
            var dialog = cd.createElement('iframe');
            C.iv(dialog);
            dialog.frameBorder = 0;
            dialog.allowTransparency = true;
            var qy = O.ae && (!O.gM || !C.fj(bI.document));
            C.dW(dialog, {
                'position': (qy) ? 'absolute': 'fixed',
                'width': es + 'px',
                'height': cT + 'px',
                'zIndex': hJ()
            });
            this.kf(dialog, es, cT);
            dialog.src = A.bF + "/dialog/dialog.htm";
            dialog.kh = qL;
            cd.body.appendChild(dialog);
            dialog.hY = dJ;
            dJ = dialog;
        },
        ud: function(qJ) {
            var dialog = qJ.frameElement;
            C.cW(dialog);
            if (dialog.hY) {
                dJ = dialog.hY;
                jY(dJ);
            } else {
                ri();
                setTimeout(function() {
                    dJ = null;
                },
                0);
                I.nz();
            }
        },
        kf: function(dialog, es, cT) {
            if (!es) {
                es = parseInt(dialog.style.width, 10);
            }
            if (!cT) {
                cT = parseInt(dialog.style.height, 10);
            }
            var ky = C.fK(bI);
            var ip = {
                'X': 0,
                'Y': 0
            };
            var qI = O.ae && (!O.gM || !C.fj(bI.document));
            if (qI) {
                ip = C.gJ(bI);
            }
            var cP = Math.max(ip.Y + (ky.Height - cT - 20) / 2, 0);
            var os = Math.max(ip.X + (ky.Width - es - 20) / 2, 0);
            C.dW(dialog, {
                'top': cP + 'px',
                'left': os + 'px'
            });
        },
        tv: function() {
            return cf;
        },
        uv: function() {
            return dJ;
        }
    };
})();
var cq = (function() {
    var rb = function(btn) {
        btn.onmouseover = oz;
        btn.onmouseout = ox;
        btn.onmousedown = oF;
        btn.onmouseup = oy;
        btn.ondragstart = C.aR;
        btn.onselectstart = C.aR;
        btn.onselect = C.aR;
        btn.qD = true;
        return true;
    };
    var gi = function(e) {
        if (!e) {
            e = window.event;
        }
        var t = e.srcElement || e.target;
        if (t.tagName == "IMG") {
            t = t.parentNode;
        }
        if (t.className == "TB_Btn_Image") {
            t = t.parentNode;
        }
        return t;
    };
    var oz = function(e) {
        var t = gi(e);
        t.className = "TB_Btn_Over";
    };
    var ox = function(e) {
        var t = gi(e);
        if (t.cn) {
            t.className = "TB_Btn_Down";
        } else {
            t.className = "TB_Btn";
        }
    };
    var oF = function(e) {
        var t = gi(e);
        t.className = "TB_Btn_Down";
    };
    var oy = function(e) {
        var t = gi(e);
        if (t.className = "TB_Btn_Down") {
            t.className = "TB_Btn_Over";
        } else {
            if (t.cn) {
                t.className = "TB_Btn_Down";
            } else {
                t.className = "TB_Btn";
            }
        }
    };
    var eg;
    var hR = function() {
        if (eg) {
            return;
        }
        var kW = {
            normal: ["Bold", "Italic", "UnderLine", "StrikeThrough", "SuperScript", "SubScript", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyFull"],
            mode: ["ModeCode", "ModeEdit", "ModeView", "ModeText"],
            other: ["ShowBlocks", "ShowBorders", "Maximize"]
        };
        var K = $("eWebEditor_Toolbar").getElementsByTagName("DIV");
        eg = new Object;
        for (gm in kW) {
            var kT = kW[gm];
            var gk = new Object;
            for (var i = 0; i < kT.length; i++) {
                var bC = kT[i];
                gk[bC] = new Array();
                for (var j = 0; j < K.length; j++) {
                    var t = K[j];
                    if (t.getAttribute("name") == "TB_Name_" + bC) {
                        gk[bC][gk[bC].length] = t;
                    }
                }
            }
            eg[gm] = gk;
        }
    };
    var nU = function(gO) {
        hR();
        var eQ = eg["normal"];
        for (bC in eQ) {
            var v = A.F.queryCommandState(bC);
            var K = eQ[bC];
            for (var j = 0; j < K.length; j++) {
                var t = K[j];
                t.cn = v;
                if (gO) {
                    t.className = "TB_Btn";
                } else {
                    if (v) {
                        t.className = "TB_Btn_Down";
                    } else {
                        t.className = "TB_Btn";
                    }
                }
            }
        }
    };
    var qY = function() {
        hR();
        var eQ = eg["mode"];
        for (bC in eQ) {
            var K = eQ[bC];
            for (var j = 0; j < K.length; j++) {
                var t = K[j];
                var bn = t.getAttribute("name");
                bn = bn.substr(bn.length - 4).toUpperCase();
                if (bn == A.av) {
                    t.cn = "on";
                    t.className = "TB_Btn_Down";
                } else {
                    t.cn = "";
                    t.className = "TB_Btn";
                }
            }
        }
    };
    var nP = function(gO) {
        var cF, v;
        cF = "FontName";
        if (gO) {
            v = "";
        } else {
            v = A.F.queryCommandValue(cF);
        }
        lu(cF, v);
        cF = "FontSize";
        if (gO) {
            v = "";
        } else {
            v = A.F.queryCommandValue(cF);
            if (v) {
                v = kQ(v);
            } else {
                v = rn();
            }
        }
        lu(cF, v);
    };
    var lu = function(cF, v) {
        var K = document.getElementsByName("TB_Name_" + cF);
        for (var i = 0; i < K.length; i++) {
            var t = K[i];
            if (v) {
                v = v.toLowerCase();
                v = v.replace(/[\'\"]/gi, '');
                var b = false;
                for (var j = 0; j < t.options.length; j++) {
                    var mg = t.options[j].value.toLowerCase();
                    if (mg == v || (cF == "FontSize" && ob(mg, v))) {
                        t.selectedIndex = j;
                        b = true;
                        break;
                    }
                }
                if (!b) {
                    t.options[t.options.length] = new Option(v, v);
                    t.selectedIndex = t.options.length - 1;
                }
            } else {
                t.selectedIndex = 0;
            }
        }
    };
    var ob = function(aL, bq) {
        aL = aL.toLowerCase();
        bq = bq.toLowerCase();
        if (aL == bq) {
            return true;
        }
        if (aL.kz("pt") && bq.kz("px")) {
            var gB = 0;
            aL = parseFloat(aL) + "";
            var n = aL.indexOf(".");
            if (n >= 0) {
                var s = aL.substr(n + 1);
                gB = s.length;
            }
            if (gB > 0) {
                if (aL == Math.round(parseFloat(bq) * 3 / 4 * Math.pow(10, gB) + 0.01) / Math.pow(10, gB)) {
                    return true;
                }
            } else {
                if (aL == parseInt(parseFloat(bq) * 3 / 4 + 0.01)) {
                    return true;
                }
            }
        }
        return false;
    };
    var rn = function() {
        var r = "";
        var iK = I.dm();
        if (!iK) {
            return "";
        }
        var dG = I.bH().getRangeAt(0);
        var iL = A.F.createRange();
        r = C.cG(iK, "font-size");
        var K = iK.getElementsByTagName("*");
        for (var i = 0; i < K.length; i++) {
            var t = K[i];
            iL.selectNodeContents(t);
            if ((iL.compareBoundaryPoints(Range.START_TO_END, dG) >= 0) && (iL.compareBoundaryPoints(Range.END_TO_START, dG) <= 0)) {
                var v = C.cG(t, "font-size");
                if (r != v) {
                    r = "";
                    break;
                }
            }
        }
        if (r != "") {}
        return r;
    };
    return {
        rd: function() {
            var i, K, t, p;
            p = $("eWebEditor_Toolbar");
            K = p.getElementsByTagName("div");
            for (i = 0; i < K.length; i++) {
                t = K[i];
                if (t.className == "TB_Btn") {
                    if (t.qD == null) {
                        if (!rb(t)) {
                            alert("Problem initializing:" + t.id);
                            return false;
                        }
                    }
                }
            }
            return true;
        },
        fv: function() {
            if (A.av != "EDIT") {
                return;
            }
            var b = (I.ay() == "Control") ? true: false;
            nU(b);
            nP(b);
        },
        pk: function() {
            qY();
        },
        hN: function(gm, pv) {
            hR();
            return eg[gm][pv];
        }
    };
})();
var xC = (function() {
    var ap;
    var as;
    var ke;
    var bP;
    return {
        be: function() {
            if (I.ay() != "Control") {
                var t = I.dm();
                while (t.tagName.toUpperCase() != "TD" && t.tagName.toUpperCase() != "TH") {
                    if (t.tagName.toUpperCase() == "BODY") {
                        t = null;
                        break;
                    }
                    t = t.parentNode;
                    if (t == null) {
                        break;
                    }
                }
                if (t) {
                    ap = t;
                    as = ap.parentNode;
                    ke = as.parentNode;
                    bP = ke.parentNode;
                    return true;
                }
            }
            return false;
        },
        gE: function() {
            if (I.ay() == "Control") {
                var t = I.aX();
                if (t.tagName.toUpperCase() == "TABLE") {
                    bP = t;
                    return true;
                }
            }
            return false;
        },
        TableInsert: function() {
            if (!xC.gE()) {
                showDialog('table.htm', true);
            }
        },
        TableProp: function() {
            if (xC.gE() || xC.be()) {
                showDialog('table.htm?action=modify', true);
            }
        },
        CellProp: function() {
            if (xC.be()) {
                showDialog('tablecell.htm', true);
            }
        },
        CellSplit: function() {
            if (xC.be()) {
                showDialog('tablecellsplit.htm', true);
            }
        },
        RowProp: function() {
            if (xC.be()) {
                showDialog('tablecell.htm?action=row', true);
            }
        },
        RowInsertAbove: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            var cr = 0;
            bY = as.cells;
            for (var i = 0; i < bY.length; i++) {
                cr = cr + bY[i].getAttribute('colSpan');
            }
            var fp = bP.insertRow(as.rowIndex);
            for (i = 0; i < cr; i++) {
                de = fp.insertCell( - 1);
                de.innerHTML = "&nbsp;";
            }
            xB.Save();
        },
        RowInsertBelow: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            var cr = 0;
            bY = as.cells;
            for (var i = 0; i < bY.length; i++) {
                cr = cr + bY[i].getAttribute('colSpan');
            }
            var fp = bP.insertRow(as.rowIndex + 1);
            for (i = 0; i < cr; i++) {
                de = fp.insertCell( - 1);
                de.innerHTML = "&nbsp;";
            }
            xB.Save();
        },
        RowMerge: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            var wj = ap.getAttribute('rowSpan');
            aq = bP.rows;
            if (as.rowIndex + 1 != aq.length) {
                var qN = aq[as.rowIndex + ap.rowSpan].cells;
                var ih = qN[ap.cellIndex].getAttribute('rowSpan');
                var moveTo = ap.rowSpan;
                if (!ih) ih = 1;
                ap.rowSpan = ap.rowSpan + ih;
                aq[as.rowIndex + moveTo].deleteCell(ap.cellIndex);
            }
            xB.Save();
        },
        RowSplit: function(lz) {
            if (!xC.be()) {
                return;
            }
            if (lz < 2) {
                return;
            }
            xB.Save();
            var qb = lz - 1;
            var ig = qb;
            var eV = 0;
            for (var i = 0; i < ap.cellIndex; i++) {
                eV += as.cells[i].colSpan;
            }
            var aq = bP.rows;
            while (ap.rowSpan > 1 && ig > 0) {
                var iE = aq[as.rowIndex + ap.rowSpan - 1];
                ap.rowSpan -= 1;
                var fs = 0;
                var position = -1;
                for (var n = 0; n < iE.cells.length; n++) {
                    fs += iE.cells[n].getAttribute('colSpan');
                    if (fs > eV) {
                        position = n;
                        break;
                    }
                }
                var de = iE.insertCell(position);
                de.innerHTML = "&nbsp;";
                ig -= 1;
            }
            for (var n = 0; n < ig; n++) {
                var cr = 0;
                bY = as.cells;
                for (var i = 0; i < bY.length; i++) {
                    cr = cr + bY[i].getAttribute('colSpan');
                }
                var fp = bP.insertRow(as.rowIndex + 1);
                for (var j = 0; j < as.rowIndex; j++) {
                    for (var k = 0; k < aq[j].cells.length; k++) {
                        if ((aq[j].cells[k].rowSpan > 1) && (aq[j].cells[k].rowSpan >= as.rowIndex - aq[j].rowIndex + 1)) {
                            aq[j].cells[k].rowSpan += 1;
                        }
                    }
                }
                for (i = 0; i < bY.length; i++) {
                    if (i != ap.cellIndex) {
                        as.cells[i].rowSpan += 1;
                    } else {
                        de = fp.insertCell( - 1);
                        de.colSpan = ap.colSpan;
                        de.innerHTML = "&nbsp;";
                    }
                }
            }
            xB.Save();
        },
        RowDelete: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            bP.deleteRow(as.rowIndex);
            xB.Save();
        },
        ColInsertLeft: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            eR = (as.cells.length - 1) - (ap.cellIndex);
            aq = bP.rows;
            for (i = 0; i < aq.length; i++) {
                iM = aq[i].cells.length - 1;
                position = iM - eR;
                if (position < 0) {
                    position = 0;
                }
                cO = aq[i].insertCell(position);
                cO.innerHTML = "&nbsp;";
            }
            xB.Save();
        },
        ColInsertRight: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            eR = (as.cells.length - 1) - (ap.cellIndex);
            aq = bP.rows;
            for (i = 0; i < aq.length; i++) {
                iM = aq[i].cells.length - 1;
                position = iM - eR;
                if (position < 0) {
                    position = 0;
                }
                cO = aq[i].insertCell(position + 1);
                cO.innerHTML = "&nbsp;";
            }
            xB.Save();
        },
        ColMerge: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            var qz = ap.getAttribute('colSpan');
            bY = as.cells;
            if (ap.cellIndex + 1 != as.cells.length) {
                var qa = bY[ap.cellIndex + 1].getAttribute('colSpan');
                ap.colSpan = qz + qa;
                as.deleteCell(ap.cellIndex + 1);
            }
            xB.Save();
        },
        ColDelete: function() {
            if (!xC.be()) {
                return;
            }
            xB.Save();
            eR = (as.cells.length - 1) - (ap.cellIndex);
            aq = bP.rows;
            for (var i = 0; i < aq.length; i++) {
                pV = aq[i].cells.length - 1;
                position = pV - eR;
                if (position < 0) {
                    position = 0;
                }
                hy = aq[i].cells;
                if (hy[position].colSpan > 1) {
                    hy[position].colSpan = hy[position].colSpan - 1;
                } else {
                    aq[i].deleteCell(position);
                }
            }
            xB.Save();
        },
        ColSplit: function(lj) {
            if (!xC.be()) {
                return;
            }
            if (lj < 2) {
                return;
            }
            xB.Save();
            var pZ = lj - 1;
            var gq = pZ;
            var cO;
            var eV = 0;
            var iy = 0;
            for (var i = 0; i < ap.cellIndex; i++) {
                eV += as.cells[i].colSpan;
                if (as.cells[i].rowSpan > 1) {
                    iy += 1;
                }
            }
            var aq = bP.rows;
            while (ap.colSpan > 1 && gq > 0) {
                cO = as.insertCell(ap.cellIndex + 1);
                cO.innerHTML = "&nbsp;";
                ap.colSpan -= 1;
                gq -= 1;
            }
            for (i = 0; i < aq.length; i++) {
                var fs = 0;
                var position = -1;
                for (var n = 0; n < aq[i].cells.length; n++) {
                    fs += aq[i].cells[n].getAttribute('colSpan');
                    if (fs + iy > eV) {
                        position = n;
                        break;
                    }
                }
                if (as.rowIndex != i) {
                    if (position != -1) {
                        aq[i].cells[position + iy].colSpan += gq;
                    }
                } else {
                    for (var n = 0; n < gq; n++) {
                        cO = aq[i].insertCell(ap.cellIndex + 1);
                        cO.innerHTML = "&nbsp;";
                        cO.rowSpan = ap.rowSpan;
                    }
                }
            }
            xB.Save();
        }
    };
})();
var xB = (function() {
    var bS = [];
    var bv = 0;
    var dB = [];
    var gK = false;
    var kr = function() {
        var lW = dB[bv];
        if (lW) {}
    };
    var um = function(t) {
        var K = A.F.body.getElementsByTagName(t.tagName);
        for (var i = 0; i < K.length; i++) {
            if (K[i] == t) {
                return i;
            }
        }
        return null;
    };
    return {
        pi: function() {
            if (bS.length <= 1 || bv <= 0) {
                return false;
            }
            return true;
        },
        ph: function() {
            if (bv >= bS.length - 1 || bS.length == 0) {
                return false;
            }
            return true;
        },
        hG: function() {
            gK = false;
        },
        Save: function() {
            if (gK) {
                return;
            }
            gK = true;
            var f = getHTML();
            if (bS[bv] == f) {
                return;
            }
            var ow = bS.length;
            var oe = bS.length - bv;
            for (var i = 1; i < oe; i++) {
                bS.pop();
                dB.pop();
            }
            bS[bS.length] = f;
            try {
                dB[dB.length] = A.bi.getSelection().getRangeAt(0).endContainer;
            } catch(e) {
                dB[dB.length] = "";
            }
            if (ow != 0) {
                bv++;
            }
        },
        Go: function(v) {
            if (!gK) {
                this.Save();
            }
            if (v == -1) {
                if (bv > 0) {
                    bv = bv - 1;
                    setHTML(bS[bv], true);
                    kr();
                }
            } else {
                if (bv < bS.length - 1) {
                    bv = bv + 1;
                    setHTML(bS[bv], true);
                    kr();
                }
            }
            A.Focus();
            cq.fv();
        }
    };
})();
var U;
function dz(kF) {
    if (U) {
        U = null;
    }
    var b = false;
    try {
        U = new ActiveXObject("eWebSoft.eWebEditor3");
        var lA = U.Version;
        if (parseFloat(lA.replace(/[^0123456789]+/gi, "")) >= 3000) {
            U.Lang = lang.ax;
            U.SendUrl = A.SendUrl;
            U.LocalSize = config.AllowLocalSize;
            U.LocalExt = config.AllowLocalExt;
            b = true;
        }
    } catch(e) {}
    if (!b && kF) {
        /*showDialog("installactivex.htm",true)*/
        cleanAndPaste(GetClipboardHTML());
    }
    return b;
};
function ef() {
    var dr = U.Error;
    if (dr != "") {
        var fG, fE;
        if (dr.indexOf(":") >= 0) {
            var a = dr.split(":");
            fG = a[0];
            fE = a[1];
        } else {
            fG = dr;
            fE = "";
        }
        switch (fG) {
        case "L":
            alert(lang["ErrLicense"]);
            break;
        case "InvalidFile":
            alert(lang["ErrInvalidFile"] + ":" + fE);
            break;
        default:
            alert(dr);
        }
        return true;
    }
    return false;
};
var A = {
    F: null,
    bi: null,
    av: null,
    bj: null,
    BaseHref: "",
    bF: "",
    gY: "",
    SendUrl: "",
    ReadyState: "",
    Focus: function() {
        if (A.av == "CODE" || A.av == "TEXT") {
            A.db.focus();
            return;
        }
        this.bi.focus();
    },
    Init: function() {
        if (!config.L) {
            return;
        }
        if (!O.hU) {
            return;
        }
        this.gY = document.location.protocol.toLowerCase() + "//" + document.location.host;
        var s = document.location.pathname;
        this.bF = s.substr(0, s.length - 15);
        this.BaseHref = "";
        if (config.BaseHref != "") {
            this.BaseHref = "<base href='" + this.gY + config.BaseHref + "'></base>";
        }
        if (ag.ExtCSS) {
            this.ExtCSS = "<link href='" + qq(ag.ExtCSS) + "' type='text/css' rel='stylesheet'>";
        } else {
            this.ExtCSS = "";
        }
        if (ag.Skin) {
            config.Skin = ag.Skin;
        }
        if (ag.FixWidth) {
            config.FixWidth = ag.FixWidth;
        }
        if (ag.AreaCssMode) {
            config.AreaCssMode = ag.AreaCssMode;
        }
        if (ag.ReadOnly) {
            config.InitMode = "VIEW";
            if (ag.ReadOnly == "2") {
                config.StateFlag = "";
            } else {
                config.SBCode = "";
                config.SBEdit = "";
                config.SBText = "";
                config.SBView = "";
            }
        }
        this.SendUrl = this.gY + this.bF + "/" + config.ServerExt + "/upload." + config.ServerExt + "?style=" + ag.StyleName + "&cusdir=" + ag.CusDir + "&sparams=" + config.SParams;
        C.ao(document, 'contextmenu', gf);
        C.ao(document, 'dragstart', gf);
        C.ao(document, 'selectstart', gf);
        C.ao(document, 'select', gf);
        if (O.jx && !O.hW) {
            window.onresize = function(e) {
                if (e && e.originalTarget !== document && e.originalTarget !== window && (!e.originalTarget.ownerDocument || e.originalTarget.ownerDocument != document)) {
                    return;
                }
                im();
            };
        }
    }
};
A.iT = function() {
    var cB = this.F;
    try {
        cB.designMode = 'on';
        cB.execCommand("styleWithCSS", false, "true");
        cB.execCommand("enableInlineTableEditing", false, "false");
        if (config.EnterMode == "2") {
            cB.execCommand("insertBrOnReturn", false, "true");
        }
    } catch(e) {
        C.ao(this.bi.frameElement, 'DOMAttrModified', nI);
    }
};
function nI(bW) {
    if (A.hP) {
        window.clearTimeout(A.hP);
    }
    A.hP = C.mo(qv, 1000, A);
};
function qv() {
    delete this.hP;
    C.lo(this.bi.frameElement, 'DOMAttrModified', nI);
    this.iT();
};
function gf(e) {
    if (A.av == "EDIT" || A.av == "VIEW") {
        return C.aR(e);
    }
};
function im() {
    var fB = $('eWebEditor');
    if (fB) {
        var kX = fB.parentNode;
        fB.style.width = (kX.scrollWidth - 4) + 'px';
        fB.style.height = (kX.scrollHeight - 4) + 'px';
        fB.style.height = "100%";
    } else {
        window.setTimeout(im, 10);
    }
};
var config = new Object();
window.onload = qk;
function qk() {
    if (!config.L) {
        return;
    }
    if (A.ReadyState) {
        return;
    }
    A.ReadyState = "loading";
    C.lk(window);
    if (!O.hU) {
        return;
    }
    A.bj = parent.document.getElementsByName(ag.bj)[0];
    if (O.jx && !O.hW) {
        im();
    }
    cq.rd();
    C.DisableSelection(document.body);
    $("eWebEditorTextarea").style.MozUserSelect = "text";
    A.bi = $("eWebEditor").contentWindow;
    A.F = A.bi.document;
    A.db = $("eWebEditorTextarea");
    if (!O.hU) {
        config.InitMode = "TEXT";
    }
    if ($("D_ContentFlag").value == "0") {
        $("D_ContentEdit").value = A.bj.value;
        $("D_ContentLoad").value = A.bj.value;
        $("D_CurrMode").value = config.InitMode;
        $("D_ContentFlag").value = "1";
    }
    setMode($("D_CurrMode").value, true);
    qs();
    A.ReadyState = "complete";
    try {
        parent.EWEBEDITOR_OnLoadComplete(ag.bj);
    } catch(e) {}
};
function qs() {
    if (!A.bj) {
        return;
    }
    var aH = A.bj.form;
    if (!aH) {
        return;
    }
    C.ao(aH, 'submit', kn);
    if (!aH.submitEditor) {
        aH.submitEditor = new Array();
    }
    aH.submitEditor[aH.submitEditor.length] = kn;
    if (!aH.originalSubmit) {
        aH.originalSubmit = aH.submit;
        aH.submit = function() {
            if (this.submitEditor) {
                for (var i = 0; i < this.submitEditor.length; i++) {
                    this.submitEditor[i]();
                }
            }
            this.originalSubmit();
        };
    }
    C.ao(aH, 'reset', kt);
    if (!aH.eq) aH.eq = new Array();
    aH.eq[aH.eq.length] = kt;
    if (!aH.originalReset) {
        aH.originalReset = aH.reset;
        aH.reset = function() {
            if (this.eq) {
                for (var i = 0; i < this.eq.length; i++) {
                    this.eq[i]();
                }
            }
            this.originalReset();
        };
    }
};
function kn() {
    var aH = A.bj.form;
    if (!aH) {
        return;
    }
    var f = getHTML();
    if (config.PaginationMode != "0" && config.PaginationAutoFlag != "0") {
        if (A.av != "EDIT") {
            setMode("EDIT");
        }
        var b = true;
        if (config.PaginationAutoFlag == "1") {
            var K = A.F.getElementsByTagName("IMG");
            for (var i = 0; i < K.length; i++) {
                var cD = K[i].getAttribute("eWebEditorFake", 2);
                if (cD) {
                    if (cD.toLowerCase() == "pagination") {
                        b = false;
                        break;
                    }
                }
            }
        }
        if (b) {
            xF.Auto(config.PaginationAutoNum);
            f = getHTML();
        }
    }
    $("D_ContentEdit").value = f;
    mz(A.bj, f);
};
function kt() {
    setHTML($("D_ContentLoad").value);
};
function qm() {
    var dI = A.bj.form;
    if (!dI) {
        return;
    }
    if (dI.onsubmit) {
        if (dI.onsubmit()) {
            dI.submit();
        }
    } else {
        dI.submit();
    }
};
function ks(e) {
    showDialog('about.htm');
    return C.aR(e);
};
function qp(e) {
    if (!e) {
        e = eWebEditor.event;
    }
    if (config.AutoDetectPaste == "2") {
        window.setTimeout("xP()", 10);
        return C.aR(e);
    }
    xB.Save();
    return true;
};
function pU(e) {
    if (!e) {
        e = eWebEditor.event;
    }
    var aD = e.keyCode || e.which;
    var aF = String.fromCharCode(aD).toUpperCase();
    if (e.ctrlKey || ((aD >= 33) && (aD <= 40)) || (aD == 13) || (aD == 8) || (aD == 46)) {
        cq.fv();
    }
    return true;
};
function pQ(e) {
    if (!e) {
        e = eWebEditor.event;
    }
    var aD = e.keyCode || e.which;
    var aF = String.fromCharCode(aD).toUpperCase();
    var aY = false;
    if (aD == 112 && !O.ae) {
        showDialog("about.htm");
        aY = true;
    }
    if (aD == 113) {
        xJ.Execute();
        aY = true;
    }
    if (aD == 114) {
        xI.Execute();
        aY = true;
    }
    if (e.ctrlKey) {
        if (aD == 13) {
            qm();
            aY = true;
        }
        if (aD == 187 || aD == 107) {
            xO(300);
            aY = true;
        }
        if (aD == 189 || aD == 109) {
            xO( - 300);
            aY = true;
        }
        if (aF == "1") {
            setMode("CODE");
            aY = true;
        }
        if (aF == "2") {
            setMode("EDIT");
            aY = true;
        }
        if (aF == "3") {
            setMode("TEXT");
            aY = true;
        }
        if (aF == "4") {
            setMode("VIEW");
            aY = true;
        }
        if (aF == "A") {
            if ((A.av != "CODE") && (config.FixWidth)) {
                lX();
            } else {
                A.Focus();
                xB.Save();
                A.F.execCommand("SelectAll", false, null);
                xB.Save();
                A.Focus();
            }
            aY = true;
        }
        if (aF == "D") {
            xS();
            aY = true;
        }
        if (aF == "R") {
            xU();
            aY = true;
        }
        if (aF == "Z") {
            xB.Go( - 1);
            aY = true;
        }
        if (aF == "Y") {
            xB.Go(1);
            aY = true;
        }
        if (aF == "V" && O.ae) {
            window.setTimeout("xW()", 10);
            aY = true;
        }
    }
    if ((config.EnterMode == "2") && (aD == 13) && O.ae) {
        xB.Save();
        xB.hG();
        var al = A.F.selection.createRange();
        if (e.shiftKey) {
            var p = al.parentElement();
            if (p.tagName != "P" || p.innerHTML == "") {
                al.pasteHTML("&nbsp;");
                al.select();
                al.collapse(false);
            }
            try {
                al.pasteHTML("</P><P id=eWebEditor_Temp_P>");
            } catch(qo) {
                return false;
            }
            e.cancelBubble = true;
            e.returnValue = false;
            var t = A.F.getElementById("eWebEditor_Temp_P");
            if (t.innerHTML == "") {
                t.innerHTML = "&nbsp;";
            }
            al.moveToElementText(t);
            al.select();
            al.collapse(false);
            al.select();
            t.removeAttribute("id");
        } else {
            try {
                al.pasteHTML("<br>");
            } catch(qo) {
                return false;
            }
            e.cancelBubble = true;
            e.returnValue = false;
            al.select();
            al.moveEnd("character", 1);
            al.moveStart("character", 1);
            al.collapse(false);
        }
        aY = true;
    }
    if (aY) {
        return C.aR(e);
    } else {
        if ((aD == 13) || (aD == 8) || (aD == 46)) {
            xB.Save();
            xB.hG();
        } else if ((aD >= 33) && (aD <= 40)) {
            xB.Save();
        } else if (! ((e.ctrlKey && aF == "A") || (e.ctrlKey && aF == "F"))) {
            xB.hG();
        }
        return true;
    }
};
function pY() {};
function pW() {
    xB.Save();
    cq.fv();
};
function pR() {
    xB.Save();
    return true;
};
function qq(R) {
    if (R.indexOf("://") >= 0) {
        return R;
    }
    if (R.substr(0, 1) == "/") {
        return R;
    }
    var gQ = A.bF;
    while (R.substr(0, 3) == "../") {
        R = R.substr(3);
        gQ = gQ.substring(0, gQ.lastIndexOf("/"));
    }
    return gQ + "/" + R;
};
function insertHTML(f) {
    if (md()) {
        return;
    }
    switch (A.av) {
    case "EDIT":
        I.eF();
        A.Focus();
        f = M.iP(f);
        var sX = A.F.createDocumentFragment();
        var pH = A.F.createElement('div');
        pH.innerHTML = f;
        var tk;
        while ((tk = pH.firstChild)) {
            sX.appendChild(pH.removeChild(tk));
        }
        var hi = A.bi.getSelection().getRangeAt(0);
        hi.deleteContents();
        hi.insertNode(sX);
        cq.fv();
        break;
    case "TEXT":
    case "CODE":
        A.db.focus();
        A.db.execCommand("insertHTML", false, f);
        break;
    }
};
function setHTML(f, qG) {
    $("D_ContentEdit").value = f;
    switch (A.av) {
    case "CODE":
        A.db.value = oX.pa(f);
        break;
    case "TEXT":
        f = f.replace(/<script[^>]*?>(?:[^a]|a)*?<\/script>/gi, "");
        f = f.replace(/<style[^>]*?>(?:[^a]|a)*?<\/style>/gi, "");
        f = f.replace(/<object[^>]*?>(?:[^a]|a)*?<\/object>/gi, "");
        f = f.replace(/<embed[^>]*?>(?:[^a]|a)*?<\/embed>/gi, "");
        f = f.replace(/<table[^>]*?>(?:[^a]|a)*?<\/table>/gi, "");
        $("eWebEditor_Temp_HTML").innerHTML = f;
        f = qO($("eWebEditor_Temp_HTML"));
        A.db.value = f;
        break;
    case "EDIT":
        A.F.designMode = "on";
        A.F.open();
        A.F.write(kS(M.iP(f)));
        A.F.close();
        A.iT();
        C.ao(A.F.body, 'paste', qp);
        C.ao(A.F, 'help', ks);
        C.ao(A.F.body, 'dragend', pR);
        C.ao(A.F, 'keydown', pQ);
        C.ao(A.F, 'keyup', pU);
        C.ao(A.F, 'contextmenu', xD.qr);
        C.ao(A.F, 'mousedown', pY);
        C.ao(A.F, 'mouseup', pW);
        break;
    case "VIEW":
        A.F.designMode = "off";
        A.F.open();
        A.F.write(kS(f));
        A.F.close();
        C.ao(A.F, 'help', ks);
        C.ao(A.F, 'contextmenu', C.aR);
        break;
    }
    if (!qG) {
        xB.Save();
    }
};
function getHTML(qA) {
    var f;
    switch (A.av) {
    case "CODE":
        f = A.db.value;
        break;
    case "EDIT":
        xF.oZ();
        if (config.FixWidth) {
            f = A.F.getElementById("eWebEditor_FixWidth_DIV").innerHTML;
        } else {
            f = A.F.body.innerHTML;
        }
        f = M.pK(f);
        break;
    case "VIEW":
        f = $("D_ContentEdit").value;
        break;
    case "TEXT":
        f = A.db.value;
        f = ej(f);
        break;
    default:
        f = $("D_ContentEdit").value;
        break;
    }
    if (!qA) {
        if ((f.toLowerCase() == "<p>&nbsp;</p>") || (f.toLowerCase() == "<p></p>")) {
            f = "";
        }
    }
    return f;
};
function appendHTML(f) {
    if (md()) {
        return;
    }
    switch (A.av) {
    case "EDIT":
        f = M.iP(f);
        A.F.body.innerHTML += f;
        break;
    case "CODE":
    case "TEXT":
        A.db.value += f;
        break;
    }
};
function openUploadDialog(cc, on, oq, ou, ot) {
    cZ.OpenDialog('i_upload.htm?type=' + cc + '&mode=' + on + '&savepathfilename=' + oq + '&savefilename=' + ou + '&originalfilename=' + ot);
};
function eo() {
    if (A.av == "EDIT") {
        return true;
    }
    alert(lang["MsgOnlyInEditMode"]);
    return false;
};
function md() {
    if (A.av == "VIEW") {
        alert(lang["MsgCanotSetInViewMode"]);
        return true;
    }
    return false;
};
function fd() {
    if (O.ae) {
        return true;
    }
    alert(lang["MsgOnlyForIE"]);
    return false;
};
function format(am, fP) {
    if (!eo()) {
        return;
    }
    I.eF();
    A.bi.focus();
    A.Focus();
    xB.Save();
    if ((am == "unselect") && (!O.ae)) {
        I.Collapse(true);
    } else if ((am == "selectall") && (config.FixWidth)) {
        lX();
    } else {
        A.F.execCommand(am, false, fP);
    }
    xB.Save();
    A.Focus();
    cq.fv();
};
function lX() {
    var r = I.bH().getRangeAt(0);
    r.selectNodeContents(A.F.getElementById("eWebEditor_FixWidth_DIV"));
};
function kQ(s) {
    var r;
    switch (s + "") {
    case "1":
        r = "8pt";
        break;
    case "2":
        r = "10pt";
        break;
    case "3":
        r = "12pt";
        break;
    case "4":
        r = "14pt";
        break;
    case "5":
        r = "18pt";
        break;
    case "6":
        r = "24pt";
        break;
    case "7":
        r = "36pt";
        break;
    default:
        r = "";
        break;
    }
    return r;
};
function setMode(cx, qx) {
    if (cx == A.av) {
        return;
    }
    if (cx == "TEXT") {
        if (A.av == $("D_CurrMode").value) {
            if (!confirm(lang["MsgHtmlToText"])) {
                return;
            }
        }
    }
    try {
        $("eWebEditor_CODE").className = "SB_Mode_BtnOff";
    } catch(e) {}
    try {
        $("eWebEditor_EDIT").className = "SB_Mode_BtnOff";
    } catch(e) {}
    try {
        $("eWebEditor_TEXT").className = "SB_Mode_BtnOff";
    } catch(e) {}
    try {
        $("eWebEditor_VIEW").className = "SB_Mode_BtnOff";
    } catch(e) {}
    try {
        $("eWebEditor_" + cx).className = "SB_Mode_BtnOn";
    } catch(e) {}
    if (ag.ReadOnly) {
        $("eWebEditor_ToolarTREdit").style.display = "none";
        $("eWebEditor_ToolarTRText").style.display = "none";
    } else {
        if (cx == "EDIT") {
            $("eWebEditor_ToolarTREdit").style.display = "";
            $("eWebEditor_ToolarTRText").style.display = "none";
        } else {
            $("eWebEditor_ToolarTREdit").style.display = "none";
            if (config.TB2Flag == "1") {
                $("eWebEditor_ToolarTRText").style.display = "";
            } else {
                $("eWebEditor_ToolarTRText").style.display = "none";
            }
        }
    }
    if (cx == "EDIT" || cx == "VIEW") {
        $("eWebEditor").style.display = "";
        $("eWebEditorTextarea").style.display = "none";
    } else {
        $("eWebEditor").style.display = "none";
        $("eWebEditorTextarea").style.display = "";
        if (cx == "CODE") {
            $("eWebEditorTextarea").className = "codemode";
        } else {
            $("eWebEditorTextarea").className = "textmode";
        }
    }
    var f = getHTML(true);
    A.av = cx;
    $("D_CurrMode").value = cx;
    setHTML(f);
    if (cx == "EDIT") {
        xI.iw();
        xJ.iw();
    }
    cq.pk();
    if (!qx) {
        A.Focus();
    }
};
function qO(t) {
    var vn = ["p", "div", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "ol", "ul", "pre", "fieldset", "form", "table", "blockquote", "dl", "li", "br"];
    var vo = ["script", "style", "table", "object", "embed"];
    var bB = "";
    var ek = t.childNodes;
    for (var i = 0; i < ek.length; i++) {
        if (ek[i].nodeType == 1) {
            var ai = ek[i].tagName.toLowerCase();
            if (vo.eB(ai) < 0) {
                if (ai == "pre") {
                    var ro = ek[i].innerHTML;
                    ro = ro.replace(/<[^>]*?>/gi, "");
                    bB += ro;
                } else {
                    bB += qO(ek[i]);
                }
            }
            if (vn.eB(ai) >= 0) {
                bB += "\n";
            }
        } else if (ek[i].nodeType == 3) {
            bB += ek[i].nodeValue;
        }
    }
    return bB;
};
function showDialog(R, qR, qQ) {
    if (qR && !eo()) {
        return;
    }
    if (qQ && !fd()) {
        return;
    }
    if (R.indexOf(".") < 0) {
        R = R + ".htm";
    }
    xB.Save();
    cZ.OpenDialog(R);
};
function ej(f) {
    if (f == null) {
        return "";
    }
    f = f.replace(/&/gi, "&amp;");
    f = f.replace(/\"/gi, "&quot;");
    f = f.replace(/</gi, "&lt;");
    f = f.replace(/>/gi, "&gt;");
    f = f.replace(/ (?= )/gi, "&nbsp;");
    f = f.replace(/\n/gi, "<br>");
    return f;
};
function ps(f) {
    if (f == null) {
        return "";
    }
    f = f.replace(/<br(?=[ \/>]).*?>/gi, "\n");
    f = f.replace(/&nbsp;;/gi, " ");
    f = f.replace(/&quot;/gi, "\"");
    f = f.replace(/&lt;/gi, "<");
    f = f.replace(/&gt;/gi, ">");
    f = f.replace(/&amp;/gi, "&");
    return f;
};
function addUploadFile(bO, ds) {
    var ru = ds.substr(ds.lastIndexOf("/") + 1);
    iX(ag.rC, bO);
    iX(ag.rB, ru);
    iX(ag.rz, ds);
};
function iX(fy, aa) {
    if (aa == "") {
        return;
    }
    if (fy) {
        var cU = parent.document.getElementById(fy);
        if (!cU) {
            cU = parent.document.getElementsByName(fy)[0];
        }
        if (cU) {
            if (cU.value != "") {
                cU.value = cU.value + "|";
            }
            cU.value = cU.value + aa;
            try {
                cU.onchange();
            } catch(e) {}
        }
    }
};
function mz(fa, f) {
    fa.value = f;
    var lJ = fa.name;
    var dI = fa.form;
    var mv = C.dk(fa);
    var eS = 50000;
    var K = mv.getElementsByName(lJ);
    for (var i = 1; i < K.length; i++) {
        K[i].value = "";
    }
    if (f.length > eS) {
        fa.value = f.substr(0, eS);
        f = f.substr(eS);
        while (f.length > 0) {
            var gj = mv.createElement("textarea");
            gj.setAttribute("name", lJ);
            gj.style.display = "none";
            gj.value = f.substr(0, eS);
            dI.appendChild(gj);
            f = f.substr(eS);
        }
    }
};
var iG;
function remoteUpload(ov) {
    if (config.AutoRemote != "1") {
        return;
    }
    if (A.av == "TEXT") {
        return;
    }
    iG = ov;
    var oQ = document.getElementsByName("eWebEditor_UploadText")[0];
    mz(oQ, getHTML());
    ld(lang["MsgRemoteUploading"]);
    eWebEditor_UploadForm.submit();
};
function remoteUploadOK() {
    $("divProcessing").style.display = "none";
    if (A.bj) {
        if (iG) {
            eval("parent." + iG);
        }
    }
};
function yh() {
    if (!fd()) {
        return;
    }
    if (A.av == "TEXT") {
        return;
    }
    if (!dz(true)) {
        return;
    }
    ld(lang["MsgLocalUploading"]);
    var dF = getHTML();
    U.LocalUpload(dF);
    window.setTimeout("xR()", 100);
};
function xR() {
    if (U.Status != "ok") {
        window.setTimeout("xR()", 100);
        return;
    }
    if (ef()) {
        $("divProcessing").style.display = "none";
        return;
    }
    var eu = U.OriginalFiles;
    var fO = U.SavedFiles;
    if (eu) {
        var dR = eu.split("|");
        var dZ = fO.split("|");
        for (var i = 0; i < dR.length; i++) {
            if (dZ[i]) {
                var bO = dR[i];
                var ds = dZ[i];
                addUploadFile(bO, ds);
            }
        }
    }
    var dF = U.Body;
    setHTML(dF, true);
    U = null;
    $("divProcessing").style.display = "none";
};
function ld(nY) {
    msgProcessing.innerHTML = nY;
    $("divProcessing").style.top = (document.body.clientHeight - parseFloat($("divProcessing").style.height)) / 2;
    $("divProcessing").style.left = (document.body.clientWidth - parseFloat($("divProcessing").style.width)) / 2;
    $("divProcessing").style.display = "";
};
function kS(f) {
    var ey = '<head>';
    ey += '<link href="' + A.bF + '/skin/' + config.Skin + '/editarea.css" type="text/css" rel="stylesheet">';
    if (config.AreaCssMode != '1') {
        ey += '<link href="' + A.bF + '/language/' + lang.ax + '.editarea.css" type="text/css" rel="stylesheet">';
    }
    switch (A.av) {
    case 'CODE':
        break;
    case 'TEXT':
        break;
    case 'EDIT':
    case 'VIEW':
        if (config.AreaCssMode != '1') {
            ey += '<link href="' + A.bF + '/skin/' + config.Skin + '/editarea.' + lang.ax + '.css" type="text/css" rel="stylesheet">';
        }
        ey += A.ExtCSS;
        break;
    }
    ey += A.BaseHref + '</head>';
    var ad = ey;
    if (config.FixWidth) {
        ad += '<body class="ewebeditor__fixwidth">' + '<div id="eWebEditor_FixWidth_DIV" style="width:' + config.FixWidth + ';" unselectable="on">';
        ad += f + '</div></body>';
    } else {
        ad += '<body>' + f + '</body>';
    }
    return ad;
};
function getCount(hF) {
    var T = getText();
    T = T.replace(/\n/g, "");
    T = T.replace(/\r/g, "");
    var l = T.length;
    var n = 0;
    for (var i = 0; i < l; i++) {
        if (T.charCodeAt(i) < 0 || T.charCodeAt(i) > 255) {
            if (hF != 0) {
                n++;
                if (hF == 3) {
                    n++;
                }
            }
        } else {
            if (hF != 1) {
                n++;
            }
        }
    }
    return n;
};
function getText() {
    var bB;
    if (A.av == "TEXT") {
        bB = A.db.value;
    } else {
        $("eWebEditor_Temp_HTML").innerHTML = getHTML();
        if (O.ae) {
            bB = $("eWebEditor_Temp_HTML").innerText;
        } else {
            bB = qO($("eWebEditor_Temp_HTML"));
        }
    }
    return bB;
};
function jf(url) {
    document.write('<scr' + 'ipt type="text/javascript" src="' + url + '" onerror="alert(\'Error loading \' + this.src);"><\/scr' + 'ipt>');
};
function rH() {
    if (!config.L) {
        document.write("<table style='width:100%;height:100%;border-collapse:collapse' borderColor='#999999' bgColor='#ffffff' border='1px'><tr><td align='center' style='font-size:9pt'>eWebEditor!<br><br>" + lang["ErrLicense"] + "</td></tr></table>");
        return;
    }
    var J = "";
    J += "<table id='eWebEditor_Layout' border='0' cellpadding='0' cellspacing='0' width='100%' height='100%' style='table-layout:fixed'>";
    J += "<tr id='eWebEditor_ToolarPTR'><td>";
    J += "<table id='eWebEditor_Toolbar' border=0 cellpadding=0 cellspacing=0 width='100%'>";
    J += "<tr id='eWebEditor_ToolarTRText' style='display:none'><td>";
    J += kp(qc(), "Text");
    J += "</td></tr>";
    J += "<tr id='eWebEditor_ToolarTREdit' style='display:'><td>";
    J += kp(config.Toolbars, "Edit");
    J += "</td></tr>";
    J += "</table>";
    J += "</td></tr>";
    J += "<tr><td id='eWebEditor_EditareaTD' height='100%'>";
    J += "<input type='hidden' id='D_ContentEdit' value=''>";
    J += "<input type='hidden' id='D_CurrMode' value=''>";
    J += "<input type='hidden' id='D_ContentLoad' value=''>";
    J += "<input type='hidden' id='D_ContentFlag' value='0'>";
    J += "<input type='hidden' id='D_PaginationTitle' value=''>";
    J += "<textarea id='eWebEditorTextarea' style='display:none;width:100%;height:100%;'></textarea>";
    J += '<iframe id="eWebEditor" width="100%" height="100%" scrolling="yes" frameborder="0" src="' + C.iH() + '"></iframe>';
    J += "</td></tr>";
    if (config.StateFlag) {
        J += "<tr><td class='SB'>";
        J += "	<table border='0' cellpadding='0' cellspacing='0' width='100%' class='SB'>";
        J += "	<tr valign='middle'>";
        J += "	<td>";
        J += "		<table border='0' cellpadding='0' cellspacing='0' class='SB_Mode'>";
        J += "		<tr>";
        J += "		<td class='SB_Mode_Left'></td>";
        if (config.SBCode) {
            J += "		<td class=SB_Mode_BtnOff id=eWebEditor_CODE onclick=\"setMode('CODE')\" unselectable=on><table border=0 cellpadding=0 cellspacing=0><tr><td class=SB_Mode_Btn_Img>" + ep("ModeCode") + "</td><td class=SB_Mode_Btn_Text>" + lang["StatusModeCode"] + "</td></tr></table></td>";
            J += "		<td class=SB_Mode_Sep></td>";
        }
        if (config.SBEdit) {
            J += "		<td class=SB_Mode_BtnOff id=eWebEditor_EDIT onclick=\"setMode('EDIT')\" unselectable=on><table border=0 cellpadding=0 cellspacing=0><tr><td class=SB_Mode_Btn_Img>" + ep("ModeEdit") + "</td><td class=SB_Mode_Btn_Text>" + lang["StatusModeEdit"] + "</td></tr></table></td>";
            J += "		<td class=SB_Mode_Sep></td>";
        }
        if (config.SBText) {
            J += "		<td class=SB_Mode_BtnOff id=eWebEditor_TEXT onclick=\"setMode('TEXT')\" unselectable=on><table border=0 cellpadding=0 cellspacing=0><tr><td class=SB_Mode_Btn_Img>" + ep("ModeText") + "</td><td class=SB_Mode_Btn_Text>" + lang["StatusModeText"] + "</td></tr></table></td>";
            J += "		<td class=SB_Mode_Sep></td>";
        }
        if (config.SBView) {
            J += "		<td class=SB_Mode_BtnOff id=eWebEditor_VIEW onclick=\"setMode('VIEW')\" unselectable=on><table border=0 cellpadding=0 cellspacing=0><tr><td class=SB_Mode_Btn_Img>" + ep("ModeView") + "</td><td class=SB_Mode_Btn_Text>" + lang["StatusModeView"] + "</td></tr></table></td>";
        }
        J += "		</tr>";
        J += "		</table>";
        J += "	</td>";
        if (ag.qj != "1" && config.SBSize) {
            J += "	<td align=right>";
            J += "		<table border=0 cellpadding=0 cellspacing=0 class=SB_Size>";
            J += "		<tr>";
            J += "		<td class=SB_Size_Btn onclick='xO(300)' title='" + lang["SizePlus"] + "'>" + ep("SizePlus") + "</td>";
            J += "		<td class=SB_Size_Sep></td>";
            J += "		<td class=SB_Size_Btn onclick='xO(-300)' title='" + lang["SizeMinus"] + "'>" + ep("SizeMinus") + "</td>";
            J += "		<td class=SB_Size_Right></td>";
            J += "		</tr>";
            J += "		</table>";
            J += "	</td>";
        }
        J += "	</tr>";
        J += "	</Table>";
        J += "</td></tr>";
    }
    J += "</table>";
    J += "<div id='eWebEditor_Temp_HTML' style='visibility:hidden;overflow:hidden;position:absolute;width:1px;height:1px'></div>";
    J += "<div style='position:absolute;display:none'>";
    J += "<form id='eWebEditor_UploadForm' action='" + config.ServerExt + "/upload." + config.ServerExt + "?action=remote&type=remote&style=" + ag.StyleName + "&language=" + lang.ax + "&cusdir=" + ag.CusDir + "&skey=" + ag.SKey + "' method='post' target='eWebEditor_UploadTarget'>";
    J += "<input type='hidden' name='eWebEditor_UploadText'>";
    J += "</form>";
    J += '<iframe name="eWebEditor_UploadTarget" width=0 height=0 src="' + C.iH() + '"></iframe>';
    J += "</div>";
    J += "<div id=divProcessing style='width:200px;height:30px;position:absolute;display:none'>";
    J += "<table border=0 cellpadding=0 cellspacing=1 bgcolor='#000000' width='100%' height='100%'><tr><td bgcolor=#3A6EA5><marquee id='msgProcessing' align='middle' behavior='alternate' scrollamount='5' style='font-size:9pt;color:#ffffff'></marquee></td></tr></table>";
    J += "</div>";
    document.write(J);
};
function kp(la, oh) {
    var ad = "<table border='0' cellpadding='0' cellspacing='0' width='100%' id='eWebEditor_Toolbar_" + oh + "' unselectable>";
    for (var i = 0; i < la.length; i++) {
        ad += "<tr><td class='TB_Left'></td><td class='TB_Center'><table border='0' cellpadding='0' cellspacing='0'><tr>";
        var tb = la[i];
        for (var j = 0; j < tb.length; j++) {
            var az = tb[j];
            var cs = Buttons[az];
            if (az == "TBSep") {
                ad += "<td class='TB_Btn_Padding'><div class='TB_Sep'></div></td>";
            } else if (cs[3] == 0) {
                ad += "<td class='TB_Btn_Padding'><div class='TB_Btn' name='TB_Name_" + az + "' title=\"" + lang[az] + "\" onclick=\"" + cs[1] + "\">";
                if (typeof(cs[0]) == "number") {
                    var bA = "skin/" + config.Skin + "/buttons.gif";
                    var cP = 16 - cs[0] * 16;
                    if (O.ae) {
                        ad += "<div class='TB_Btn_Image'><img src='" + bA + "' style='top:" + cP + "px' /></div>";
                    } else {
                        ad += "<img class='TB_Btn_Image' src='sysimage/space.gif' style='background-position: 0px " + cP + "px;background-image: url(" + bA + ");' />";
                    }
                } else {
                    var bA = "skin/" + config.Skin + "/" + cs[0];
                    ad += "<img class='TB_Btn_Image' src='" + bA + "'>";
                }
                ad += "</div></td>";
            } else if (cs[3] == 1) {
                var fr = "";
                var dU = "";
                switch (az) {
                case "FontName":
                    fr = " style='width:115px'";
                    for (var k = 0; k < lang[az + "Item"].length; k++) {
                        dU += "<option value='" + lang[az + "Item"][k] + "'>" + lang[az + "Item"][k] + "</option>";
                    }
                    break;
                case "FontSize":
                    fr = " style='width:55px'";
                    for (var k = 0; k < lang[az + "Item"].length; k++) {
                        dU += "<option value='" + lang[az + "Item"][k][0] + "'>" + lang[az + "Item"][k][1] + "</option>";
                    }
                    break;
                case "FormatBlock":
                    fr = " style='width:90px'";
                    for (var k = 0; k < lang[az + "Item"].length; k++) {
                        dU += "<option value='" + lang[az + "Item"][k][0] + "'>" + lang[az + "Item"][k][1] + "</option>";
                    }
                    break;
                case "ZoomSelect":
                    fr = " style='width:55px'";
                    for (var k = 0; k < xE.Options.length; k++) {
                        dU += "<option value='" + xE.Options[k] + "'>" + xE.Options[k] + "%</option>";
                    }
                    break;
                }
                ad += "<td class='TB_Btn_Padding'><select name='TB_Name_" + az + "' onchange=\"" + cs[1] + "\" size=1 " + fr + "><option selected>" + lang[az] + "</option>" + dU + "</select></td>";
            }
        }
        ad += "</tr></table></td><td class='TB_Right'></td></tr>";
    }
    ad += "</table>";
    return ad;
};
function qc() {
    var a = new Array();
    var b = false;
    a.push("TBHandle");
    if (config.TB2Mode == "1") {
        a.push("ModeCode");
        a.push("ModeEdit");
        a.push("ModeText");
        a.push("ModeView");
        b = true;
    }
    if (config.TB2Max == "1") {
        if (b) {
            a.push("TBSep");
        }
        a.push("Maximize");
    }
    return [a];
};
function ep(az, mH) {
    var cu = Buttons[az];
    var cP = 16 - cu[0] * 16;
    var bA = "skin/" + config.Skin + "/buttons.gif";
    if (O.ae) {
        return "<div><img src='" + bA + "' style='top:" + cP + "px'></div>";
    } else {
        return "<img class='SB_Btn_Image' src='sysimage/space.gif' style='background-position: 0px " + cP + "px;background-image: url(" + bA + ");' />";
    }
};
var xF = new Object();
xF.Insert = function() {
    if (config.PaginationMode == "0") {
        return false;
    }
    A.Focus();
    var t;
    if (I.ay() == "Control") {
        t = I.aX();
    } else {
        t = I.dm();
    }
    t = this.ki(t);
    if (!t) {
        insertHTML("</P><P id=eWebEditor_Temp_P>");
        var p = A.F.getElementById("eWebEditor_Temp_P");
        p.removeAttribute("id");
        this.ee(p, "beforeBegin");
    } else {
        this.ee(t, "afterEnd");
    }
};
xF.ee = function(t, hA) {
    var kG = false;
    if (hA == "afterEnd" && (!t.nextSibling)) {
        kG = true;
    }
    var bM = A.F.createElement("img");
    bM.className = "ewebeditor__pagination";
    bM.setAttribute("_ewebeditor_fake_tag", "pagination");
    bM.setAttribute("src", A.bF + "/sysimage/space.gif");
    if (O.ae) {
        t.insertAdjacentElement(hA, bM);
    } else {
        if (hA == "beforeBegin") {
            t.parentNode.insertBefore(bM, t);
        } else {
            t.parentNode.insertBefore(bM, t.nextSibling);
        }
    }
    if (kG) {
        var p = A.F.createElement("p");
        t.parentElement.appendChild(p);
    }
};
xF.ki = function(t) {
    if (t.tagName == "HTML") {
        return null;
    }
    var bR = null;
    if (config.FixWidth) {
        while (! ((t.tagName.toUpperCase() == "DIV") && (t.getAttribute("id") == "eWebEditor_FixWidth_DIV"))) {
            bR = t;
            t = t.parentNode;
            if (!t || !t.tagName) {
                break;
            }
        }
    } else {
        while (t.tagName.toUpperCase() != "BODY") {
            bR = t;
            t = t.parentNode;
            if (!t || !t.tagName) {
                break;
            }
        }
    }
    return bR;
};
xF.Auto = function(rq) {
    if (config.PaginationMode == "0") {
        return false;
    }
    this.Empty();
    var ii = parseInt(rq);
    if (ii < 1) {
        return false;
    }
    if (getCount(2) <= ii) {
        return false;
    }
    if (A.av != "EDIT") {
        setMode("EDIT");
    }
    var cA;
    if (config.FixWidth) {
        cA = A.F.getElementById("eWebEditor_FixWidth_DIV");
    } else {
        cA = A.F.body;
    }
    var ek = cA.childNodes;
    var l = 0;
    for (var i = 0; i < ek.length; i++) {
        var bE = ek[i];
        if (bE.nodeType == 1) {
            var s = bE.innerText || bE.textContent;
            if (s) {
                l += s.length;
            }
        } else if (bE.nodeType == 3) {
            l += bE.length;
        }
        if (l >= ii) {
            if (bE.nextSibling) {
                if (bE.nodeType == 1) {
                    this.ee(bE, "afterEnd");
                } else {
                    this.ee(bE.nextSibling, "beforeBegin");
                }
                l = 0;
            }
        }
    }
};
xF.Empty = function() {
    if (config.PaginationMode == "0") {
        return;
    }
    var K = A.F.getElementsByTagName("IMG");
    for (var i = K.length - 1; i >= 0; i--) {
        var t = K[i];
        var cD = t.getAttribute("_ewebeditor_fake_tag", 2);
        if (cD) {
            if (cD.toLowerCase() == "pagination") {
                C.cW(t);
            }
        }
    }
};
xF.oZ = function() {
    if (config.PaginationMode == "0") {
        return false;
    }
    var K = A.F.getElementsByTagName("IMG");
    for (var i = K.length - 1; i >= 0; i--) {
        var t = K[i];
        var cD = t.getAttribute("_ewebeditor_fake_tag", 2);
        if (cD) {
            if (cD.toLowerCase() == "pagination") {
                var bR = this.ki(t);
                if (bR) {
                    var b = false;
                    if (bR.tagName == "DIV" || bR.tagName == "P") {
                        var s = bR.innerText || bR.textContent;
                        s = s.lp();
                        if (!s) {
                            b = true;
                            this.ee(bR, "beforeBegin");
                            C.cW(bR);
                        }
                    }
                    if (!b) {
                        this.ee(bR, "afterEnd");
                        C.cW(t);
                    }
                }
            }
        }
    }
};
var M = new Object();
M.iP = function(f) {
    f = this.oI(f);
    f = this.iW(f, 'script', /<script[\s\S]*?<\/script>/gi);
    f = this.iW(f, 'noscript', /<noscript[\s\S]*?<\/noscript>/gi);
    f = this.iW(f, 'comment', /<!--[\s\S]*?-->/g);
    f = this.oM(f);
    f = this.oW(f);
    f = this.oK(f);
    f = this.kZ(f, "img", "src");
    f = this.kZ(f, "a", "href");
    return f;
};
M.pK = function(f) {
    f = this.oJ(f);
    f = this.oO(f);
    f = this.oT(f);
    f = this.oV(f);
    f = this.oS(f);
    return f;
};
M.pq = function() {
    var t = I.aX();
    return t.getAttribute("_ewebeditor_fake_tag", 2);
};
M.iW = function(f, ai, pO) {
    function aQ(m) {
        return M.bD(ai, m);
    };
    return f.replace(pO, aQ);
};
M.oV = function(f) {
    function aQ(m, ai) {
        function eZ(m, aa) {
            if (['flash', 'flv', 'mediaplayer6', 'mediaplayer7', 'realplayer', 'quicktime', 'unknownobject'].eB(ai) >= 0) {
                var aw = M.ku(m, 'img');
                if (aw != '') {
                    aw = ' style=' + aw;
                }
                var di = (M.kJ(m, 'img', 'width') == '') ? M.cw(m, 'img', 'width') : '';
                var dq = (M.kJ(m, 'img', 'height') == '') ? M.cw(m, 'img', 'height') : '';
                var gC = M.cw(m, 'img', 'align');
                var gv = M.cw(m, 'img', 'vspace');
                var gy = M.cw(m, 'img', 'hspace');
                var dH = decodeURIComponent(aa);
                dH = M.lc(dH, "object", aw);
                dH = M.lc(dH, "embed", aw);
                dH = M.oU(dH, ["object", "embed"], [["width", di], ["height", dq], ["align", gC], ["vspace", gv], ["hspace", gy]]);
                return dH;
            } else {
                return decodeURIComponent(aa);
            }
        };
        return m.replace(/<img [^>]*?_ewebeditor_fake_value=\"([^\">]+?)\"[^>]*?>/gi, eZ);
    };
    return f.replace(/<img [^>]*?_ewebeditor_fake_tag=\"(\w+?)\"[^>]*?>/gi, aQ);
};
M.oI = function(f) {
    if (config.PaginationMode == "0") {
        return f;
    }
    var ad = '';
    var da = '';
    var bA = M.bD('pagination', "");
    if (config.PaginationMode == "1") {
        ad = "";
        var P = /<!--ewebeditor:page title=\"([^\">]*)\"-->((?:[^a]|a)+?)<!--\/ewebeditor:page-->/gi;
        var m;
        var gX = 0;
        while ((m = P.exec(f)) != null) {
            gX++;
            da += ps(m[1]) + "\r\n";
            if (ad != "") {
                ad += bA;
            }
            ad += m[2];
        }
        if (gX == 0) {
            ad = f;
        }
    } else {
        var P = new RegExp(config.PaginationKey.replace(/([\[\]\{\}\.\(\)\*\+\?])/gi, "\\$1"), 'gi');
        ad = f.replace(P, bA);
    }
    $("D_PaginationTitle").value = da;
    return ad;
};
M.oJ = function(f) {
    if (config.PaginationMode == "0") {
        return f;
    }
    var ad = f;
    var a = f.split(/<img [^>]*?_ewebeditor_fake_tag=\"pagination\"[^>]*?>/gi);
    if (a.length > 1) {
        if (config.PaginationMode == "1") {
            ad = "";
            var hc = $("D_PaginationTitle").value.split("\r\n");
            for (var i = 0; i < a.length; i++) {
                var da = "";
                if (hc[i]) {
                    da = ej(hc[i]);
                }
                ad += "<!--ewebeditor:page title=\"" + da + "\"-->\r\n";
                ad += a[i] + "\r\n";
                ad += "<!--/ewebeditor:page-->\r\n\r\n";
            }
        } else {
            ad = a[0];
            for (var i = 1; i < a.length; i++) {
                ad += "\r\n" + config.PaginationKey + "\r\n" + a[i];
            }
        }
    }
    return ad;
};
M.oM = function(f) {
    function aQ(m) {
        var dN = m.replace(/<object [^>]*?classid\s*=\s*[\'\"]?clsid\s*:\s*([a-z0-9\-]+)[\'\"]?[^>]*?>[\s\S]*/gi, '$1');
        dN = dN.toUpperCase();
        if (dN == 'D27CDB6E-AE6D-11CF-96B8-444553540000') {
            if (/plugin\/flvplayer\.swf/.test(m) && /flashvars[^>]*?\.flv/.test(m)) {
                return M.bD('flv', m, 'object');
            } else {
                return M.bD('flash', m, 'object');
            }
        } else if (dN == '22D6F312-B0F6-11D0-94AB-0080C74C7E95') {
            return M.bD('mediaplayer6', m, 'object');
        } else if (dN == '6BF52A52-394A-11D3-B153-00C04F79FAA6') {
            return M.bD('mediaplayer7', m, 'object');
        } else if (dN == 'CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA') {
            return M.bD('realplayer', m, 'object');
        } else if (dN == '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B') {
            return M.bD('quicktime', m, 'object');
        } else {
            return M.bD('unknownobject', m, 'object');
        }
    };
    return f.replace(/<object[\s\S]*?<\/object>/gi, aQ);
};
M.oW = function(f) {
    function aQ(m) {
        var cc = m.replace(/<embed [^>]*?type\s*=\s*[\'\"]?([^\'\"\s]+)[\'\"]?[^>]*?>[\s\S]*/gi, '$1');
        cc = cc.toLowerCase();
        if (cc == 'application/x-shockwave-flash') {
            return M.bD('flash', m, 'embed');
        } else if (['application/x-mplayer2', 'video/x-ms-asf', 'video/x-msvideo', 'video/mpeg', 'audio/mid', 'audio/mpeg', 'audio/wav', 'video/x-ms-wm', 'audio/x-ms-wma', 'video/x-ms-wmv', 'video/x-ms-wmp', 'video/x-ms-wmx'].eB(cc) >= 0) {
            return M.bD('mediaplayer6', m, 'embed');
        } else if (cc == 'video/quicktime') {
            return M.bD('quicktime', m, 'embed');
        } else if (['audio/x-pn-realaudio', 'audio/x-pn-realaudio-plugin', 'application/vnd.rn-realmedia'].eB(cc) >= 0) {
            return M.bD('realplayer', m, 'embed');
        } else {
            return M.bD('unknownobject', m, 'embed');
        }
    };
    return f.replace(/<embed[\s\S]*?<\/embed>/gi, aQ);
};
M.bD = function(ai, aa, dL) {
    if (dL) {
        var aw = M.ku(aa, dL);
        var di = M.cw(aa, dL, 'width');
        var dq = M.cw(aa, dL, 'height');
        var gC = M.cw(aa, dL, 'align');
        var gv = M.cw(aa, dL, 'vspace');
        var gy = M.cw(aa, dL, 'hspace');
        if (aw != '') {
            aw = ' style=' + aw;
        }
        var f = '<img src="' + A.bF + '/sysimage/space.gif" class="ewebeditor__' + ai + '" _ewebeditor_fake_tag="' + ai + '" _ewebeditor_fake_value="' + encodeURIComponent(aa) + '"' + aw;
        if (di != '') {
            f += ' width="' + di + '"';
        }
        if (dq != '') {
            f += ' height="' + dq + '"';
        }
        if (gC != '') {
            f += ' align="' + gC + '"';
        }
        if (gv != '') {
            f += ' vspace="' + gv + '"';
        }
        if (gy != '') {
            f += ' hspace="' + gy + '"';
        }
        f += '>';
        return f;
    } else {
        return '<img src="' + A.bF + '/sysimage/space.gif" class="ewebeditor__' + ai + '" _ewebeditor_fake_tag="' + ai + '" _ewebeditor_fake_value="' + encodeURIComponent(aa) + '">';
    }
};
M.ku = function(f, ai) {
    var P = new RegExp('^[\\s\\S]*?<' + ai + '(?=[\\s>])[^>]*?\\sstyle\\s*?=\\s*?(\'[^\'>]+?\'|\"[^\">]+?\")[^>]*?>[\\s\\S]*$', 'gi');
    if (P.test(f)) {
        return f.replace(P, '$1');
    } else {
        return '';
    }
};
M.kJ = function(f, ai, aV) {
    var P = new RegExp('^[\\s\\S]*?<' + ai + '(?=[\\s>])[^>]*?\\sstyle\\s*?=\\s*?([\'\"])[^>]*?\\b' + aV + '\\s*?:\\s*?(\\w+)(?=[\\s\;\'\"])[^>]*?\\1[^>]*?>[\\s\\S]*$', 'gi');
    if (P.test(f)) {
        return f.replace(P, '$2');
    } else {
        return '';
    }
};
M.cw = function(f, ai, aV) {
    var P = new RegExp('^[\\s\\S]*?<' + ai + '(?=[\\s>])[^>]*?\\s' + aV + '\\s*?=\\s*?([\'\"]?)(\\w+)\\1[^>]*?>[\\s\\S]*$', 'gi');
    if (P.test(f)) {
        return f.replace(P, '$2');
    } else {
        return '';
    }
};
M.lc = function(f, ai, aw) {
    function aQ(m) {
        var r = /\sstyle\s*?=\s*?([\'\"])[^>]*?\1/gi;
        if (r.test(m)) {
            aw = aw.replace('$', '\\$');
            return m.replace(r, aw);
        } else {
            return m.substring(0, m.length - 1) + aw + '>';
        }
    };
    var P = new RegExp('<' + ai + '(?=[\\s>])[^>]*?>', 'gi');
    return f.replace(P, aQ);
};
M.oU = function(f, gp, eO) {
    for (var i = 0; i < gp.length; i++) {
        f = this.oP(f, gp[i], eO);
    }
    return f;
};
M.oP = function(f, ai, eO) {
    function aQ(m) {
        var aV, fb;
        for (var i = 0; i < eO.length; i++) {
            aV = eO[i][0];
            fb = eO[i][1];
            var s = '';
            if (fb != '') {
                s = ' ' + aV + '="' + fb + '"';
            }
            var r = new RegExp('\\s' + aV + '\\s*?=\\s*?([\'\"]?)\\w+\\1', 'gi');
            if (r.test(m)) {
                m = m.replace(r, s);
            } else {
                if (fb != '') {
                    m = m.substring(0, m.length - 1) + s + '>';
                }
            }
        }
        return m;
    };
    var P = new RegExp('<' + ai + '[^>]*?>', 'gi');
    return f.replace(P, aQ);
};
M.oK = function(f) {
    function aQ(m) {
        function fi(m, aV) {
            return ' _ewebeditor_pa_' + aV + '="' + encodeURIComponent(m) + '"';
        };
        return m.replace(/\s(on\w+)[\s\r\n]*=[\s\r\n]*?(\'|\")([\s\S]*?)\2/gi, fi);
    };
    return f.replace(/<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?(\'|\")[\s\S]+?\>/gi, aQ);
};
M.oO = function(f) {
    function aQ(m, cN) {
        return decodeURIComponent(cN);
    };
    return f.replace(/\s_ewebeditor_pa_\w+=\"([^\"]+)\"/gi, aQ);
};
M.kZ = function(f, ai, aV) {
    function aQ(m, cN, fN, fS, il) {
        var r = new RegExp('<' + ai + '[\\s\\r\\n]', 'gi');
        if (!r.test(m) || /_ewebeditor_ta_/.test(m) || /_ewebeditor_fake_/.test(m)) {
            return m;
        } else {
            return cN + fN + ' _ewebeditor_ta_' + aV + '="' + encodeURIComponent(fS) + '"' + il;
        }
    };
    var P = new RegExp('(<' + ai + '[^>]*?)([\\s\\r\\n]' + aV + '[\\s\\r\\n]*?=[\\s\\r\\n]*?[\'\"]([^>\'\"]*?)[\'\"])([\\s\\S]*?>)', 'gi');
    return f.replace(P, aQ);
};
M.oT = function(f) {
    function aQ(m, aV, aa) {
        var r = new RegExp('[\\s\\r\\n]' + aV + '[\\s\\r\\n]*?=[\\s\\r\\n]*?[\'\"][^>\'\"]*?[\'\"]', 'gi');
        var s = m.replace(r, '');
        r = new RegExp('\\s_ewebeditor_ta_' + aV + '+\\s*?=\\s*?\"([^\"]*?)\"', 'gi');
        return s.replace(r, ' ' + aV + '="' + decodeURIComponent(aa) + '"');
    };
    return f.replace(/<\w+[^>]*?_ewebeditor_ta_(\w+)\s*?=\s*?\"([^\">]*?)\"[^>]*>/gi, aQ);
};
M.oS = function(f) {
    f = f.replace(/(<\w+(?=\s)[^>]*?\sclass\s*?=[^>]*?)(ewebeditor__\w+)([^>]*?>)/gi, '$1$3');
    f = f.replace(/(<\w+(?=\s)[^>]*?)(\sclass\s*?=\s*?\"\s*\")([^>]*>)/gi, '$1$3');
    return f;
};
var oX = {
    pa: function(f) {
        var iC = this.pd();
        if (iC == '') {
            return f;
        }
        var dC = this.pe(f);
        var it = new Array();
        var pg = /^\<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL|DL)[ \>]/i;
        var oN = /^\<(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL|DL)[ \/\>]/i;
        var oL = new RegExp('^' + iC);
        var eZ = function(m, cN, fN, fS, il) {
            it.push(fS);
            return cN + dC + il;
        };
        var P = /(<(style|script|pre)(?=[\s>])[^>]*?>)([\s\S]*?)(<\/\2>)/gi;
        f = f.replace(P, eZ);
        f = f.replace(/\<(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|DL|DT|DD|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi, '\n$&');
        f = f.replace(/\<\/(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|DL|DT|DD|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi, '$&\n');
        f = f.replace(/\<(BR|HR)[^\>]*\>/gi, '$&\n');
        f = f.replace(/\<\/?(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR)[^\>]*\>/gi, '\n$&\n');
        var kR = f.split(/\s*\n+\s*/g);
        var gN = '';
        f = '';
        for (var i = 0; i < kR.length; i++) {
            var gD = kR[i];
            if (gD.length == 0) {
                continue;
            }
            if (pg.test(gD)) {
                gN = gN.replace(oL, '');
            }
            f += gN + gD + '\n';
            if (oN.test(gD)) {
                gN += iC;
            }
        }
        var fi = function(m, cN, fN) {
            return cN.toLowerCase() + fN;
        };
        f = f.replace(/(<\/?\w+(?=[\s>]))([^>]*?>)/gi, fi);
        var kO = f.split(dC);
        f = kO[0];
        for (var i = 0; i < it.length; i++) {
            f += it[i] + kO[i + 1];
        }
        return f.lp();
    },
    pe: function(f) {
        var dC = '__ewebeditor__sepstr__';
        var i = 0;
        while (true) {
            i = i + 1;
            dC = dC + i;
            if (f.indexOf(dC) < 0) {
                break;
            }
        }
        return dC;
    },
    pd: function() {
        var n = parseInt(config.CodeFormat);
        var lh = '';
        for (var i = 0; i < n; i++) {
            lh += ' ';
        }
        return lh;
    }
};
function xO(mw) {
    for (var i = 0; i < parent.frames.length; i++) {
        if (parent.frames[i].document == self.document) {
            var aA = parent.frames[i].frameElement;
            var cT = parseInt(aA.offsetHeight);
            if (cT + mw >= 300) {
                aA.height = cT + mw;
            }
            break;
        }
    }
};
function yf() {
    if (!fd()) {
        return;
    }
    try {
        var qV = new ActiveXObject("ieSpell.ieSpellExtension");
        qV.vc(A.F);
    } catch(vE) {
        if (confirm(lang["MsgIeSpellDownload"])) {
            window.open("http://www.iespell.com/download.php", "IeSpellDownload");
        }
    }
};
function xU() {
    showDialog('findreplace.htm', true);
};
function yl() {
    if (!eo()) {
        return;
    }
    A.Focus();
    if (!hV()) {
        alert(lang["MsgNotParagraph"]);
        return;
    }
    showDialog('paragraph.htm', true);
};
function hV() {
    if (I.ay() == "Control") {
        return false;
    }
    var iO = A.bi.getSelection();
    var cA = A.F.body;
    var kb = cA.getElementsByTagName("P");
    for (var i = 0; i < kb.length; i++) {
        if (iO.containsNode(kb[i], true)) {
            return true;
        }
    }
    return false;
};
function yg() {
    if (!eo()) {
        return;
    }
    xB.Save();
    var b = false;
    if (I.ay() == "Control") {
        var aB = I.aX();
        if (aB.tagName.toUpperCase() == "IMG") {
            b = true;
        }
    }
    if (!b) {
        alert(lang["MsgMapLimit"]);
        return;
    }
    showDialog("map.htm", true);
};
function createLink() {
    if (!eo()) {
        return;
    }
    if (I.ay() == "Control") {
        var aB = I.aX();
        if (aB.tagName.toUpperCase() != "IMG") {
            alert(lang["MsgHylnkLimit"]);
            return;
        }
    }
    showDialog("hyperlink.htm", true);
};
function insert(am) {
    if (!eo()) {
        return;
    }
    A.Focus();
    xB.Save();
    var bB;
    if (O.ae) {
        var bu = A.F.selection.createRange();
        bB = bu.text;
    } else {
        bB = A.bi.getSelection().toString();
    }
    switch (am) {
    case "nowdate":
        var d = new Date();
        insertHTML(d.toLocaleDateString());
        break;
    case "nowtime":
        var d = new Date();
        insertHTML(d.toLocaleTimeString());
        break;
    case "br":
        insertHTML("<br>");
        break;
    case "code":
        insertHTML('<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#FDFDDF style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">' + lang["HtmlCode"] + '</font><br>' + ej(bB) + '</td></tr></table>');
        break;
    case "quote":
        insertHTML('<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#F3F3F3 style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">' + lang["HtmlQuote"] + '</font><br>' + ej(bB) + '</td></tr></table>');
        break;
    case "big":
        insertHTML("<big>" + bB + "</big>");
        break;
    case "small":
        insertHTML("<small>" + bB + "</small>");
        break;
    case "printbreak":
        insertHTML("<div style=\"FONT-SIZE: 1px; PAGE-BREAK-BEFORE: always; VERTICAL-ALIGN: middle; HEIGHT: 1px; BACKGROUND-COLOR: #c0c0c0\">&nbsp; </div>");
        break;
    default:
        alert(lang["ErrParam"]);
        break;
    }
};
var xE = {
    Options: [10, 25, 50, 75, 100, 150, 200, 500],
    kj: 100,
    Execute: function(jR) {
        if (O.ae) {
            A.F.body.runtimeStyle.zoom = jR + "%";
        } else {
            A.F.body.style.MozTransform = 'scale(' + (jR / 100) + ')';
        }
        this.kj = jR;
    }
};
function sl() {
    if (I.ay() != "Control") {
        return;
    }
    var aB = I.aX();
    if (aB.style.position != 'relative') {
        aB.style.position = 'relative';
    } else {
        aB.style.position = 'static';
    }
};
function xZ(an) {
    if (I.ay() != "Control") {
        return;
    }
    var aB = I.aX();
    if (an == 'forward') {
        aB.style.zIndex += 1;
    } else {
        aB.style.zIndex -= 1;
    }
    aB.style.position = 'relative';
};
function yb(dc) {
    I.eF();
    A.bi.focus();
    if (I.ay() != "Text") {
        return;
    }
    xB.Save();
    tZ.us(dc);
    xB.Save();
};
function formatFont(am, fP) {
    I.eF();
    A.bi.focus();
    if (I.ay() != "Text") {
        return;
    }
    xB.Save();
    var rj = "eWebEditor_Temp_FontName";
    if (["uppercase", "lowercase", "size"].eB(am) >= 0) {
        tZ.us(am, fP);
    } else {
        if (am == "face") {
            am = "fontName";
        }
        A.F.execCommand(am, false, fP);
    }
};
function nJ(H, am) {
    mx(H, am, "");
    var aW = H.children;
    for (var j = 0; j < aW.length; j++) {
        nJ(aW[j], am);
        if (aW[j].tagName == "FONT") {
            nq(aW[j]);
        }
    }
};
function jw(H) {
    var aW = H.children;
    for (var j = 0; j < aW.length; j++) {
        jw(aW[j]);
        if ((aW[j].tagName == "FONT") || (aW[j].tagName == "SPAN")) {
            if ((aW[j].style.cssText == "" && aW[j].className == "") || (aW[j].innerHTML == "")) {
                aW[j].removeNode(false);
                jw(H);
                return;
            }
        }
    }
};
function nv(H, am, v) {
    mx(H, am, v);
    var aW = H.children;
    for (var j = 0; j < aW.length; j++) {
        if ((aW[j].tagName == "SPAN") || (aW[j].tagName == "FONT")) {
            nv(aW[j], am, v);
        }
    }
};
function mx(H, am, v) {
    try {
        switch (am) {
        case "face":
            H.style.fontFamily = v;
            break;
        case "size":
            H.style.fontSize = v;
            break;
        case "color":
            H.style.color = v;
            break;
        default:
            break;
        }
    } catch(e) {}
};
function nq(t) {
    if (t.style.fontFamily == "") {
        var s = t.getAttribute("face");
        if (s) {
            t.style.fontFamily = s;
        }
    }
    t.removeAttribute("face");
    if (t.style.fontSize == "") {
        var s = t.getAttribute("size");
        s = kQ(s);
        if (s) {
            t.style.fontSize = s;
        }
    }
    t.removeAttribute("size");
    if (t.style.color == "") {
        var s = t.getAttribute("color");
        if (s) {
            t.style.color = s;
        }
    }
    t.removeAttribute("color");
};
var tZ = (function() {
    var qX, rx, lw, nD;
    var bL = [];
    var dO, hm, fk, eY, jd, rc, rf;
    return {
        us: function(bC, fP) {
            if (I.ay() != "Text") {
                return;
            }
            rx = false;
            qX = false;
            bL.length = 0;
            lw = bC;
            nD = fP;
            jd = (lw == "uppercase" || lw == "lowercase") ? true: false;
            rc = false;
            rf = false;
            var bu = A.bi.getSelection();
            var al = bu.getRangeAt(0);
            dO = al.startContainer;
            hm = al.endContainer;
            fk = al.startOffset;
            eY = al.endOffset;
            if (dO.isSameNode(hm)) {
                if (dO.nodeType == 1 && dO.tagName == "BODY") {
                    rc = true;
                    hm = this.ur(dO);
                    dO = this.uo(dO);
                    if (!dO || !hm) {
                        return;
                    }
                    fk = 0;
                    eY = hm.nodeValue.length;
                    this.rk(al.startContainer);
                } else {
                    rf = true;
                    var mE = dO.nodeValue;
                    if (jd) {
                        dO.nodeValue = mE.substring(0, fk) + this.mA(mE.substring(fk, eY)) + mE.substring(eY);
                    } else {
                        A.F.execCommand("inserthtml", false, this.mA(mE.substring(fk, eY)));
                    }
                }
            } else {
                this.rk(al.commonAncestorContainer);
            }
            if (rc) {
                A.F.execCommand("SelectAll", false, null);
            } else {
                if (jd) {
                    al.setStart(dO, fk);
                    al.setEnd(hm, eY);
                } else {
                    if (rf) {
                        var pE = A.F.getElementById("eWebEditor_Temp_Span_FontSize");
                        if (pE) {
                            pE.removeAttribute("id");
                            al.selectNodeContents(pE.firstChild);
                        }
                    } else {
                        al.setStart(dO, dO.nodeValue.length);
                        al.setEnd(hm, 0);
                    }
                }
            }
            bu.removeAllRanges();
            bu.addRange(al);
            A.Focus();
        },
        rk: function(t) {
            if (t.isSameNode(dO)) {
                rx = true;
            }
            if (rx) {
                if (t.isSameNode(dO)) {
                    if (jd) {
                        t.nodeValue = t.nodeValue.substring(0, fk) + this.mA(t.nodeValue.substring(fk));
                    } else {
                        bL[bL.length] = t;
                    }
                } else if (t.isSameNode(hm)) {
                    if (jd) {
                        t.nodeValue = this.mA(t.nodeValue.substring(0, eY)) + t.nodeValue.substring(eY);
                    } else {
                        bL[bL.length] = t;
                        for (var i = 0; i < bL.length; i++) {
                            if (bL[i].nodeValue == "") {
                                continue;
                            }
                            if (i == 0) {
                                var cK = bL[i].parentNode;
                                if ((cK.tagName.toUpperCase() == "SPAN") && (bL[i].nodeValue.substring(fk) == cK.innerHTML)) {
                                    this.nB(cK);
                                } else {
                                    var bM = this.rv(bL[i].nodeValue.substring(fk));
                                    cK.insertBefore(bM, bL[i].nextSibling);
                                    bL[i].nodeValue = bL[i].nodeValue.substring(0, fk);
                                }
                            } else if (i == bL.length - 1) {
                                var cK = bL[i].parentNode;
                                if ((cK.tagName.toUpperCase() == "SPAN") && (bL[i].nodeValue.substring(0, eY) == cK.innerHTML)) {
                                    this.nB(cK);
                                } else {
                                    var bM = this.rv(bL[i].nodeValue.substring(0, eY));
                                    cK.insertBefore(bM, bL[i]);
                                    bL[i].nodeValue = bL[i].nodeValue.substring(eY);
                                }
                            } else {
                                var cK = bL[i].parentNode;
                                if ((cK.tagName.toUpperCase() == "SPAN") && (bL[i].nodeValue == cK.innerHTML)) {
                                    this.nB(cK);
                                } else {
                                    var bM = this.rv(bL[i].nodeValue);
                                    cK.replaceChild(bM, bL[i]);
                                }
                            }
                        }
                    }
                    qX = true;
                } else if (t.nodeType == 3) {
                    if (jd) {
                        t.nodeValue = this.mA(t.nodeValue);
                    } else {
                        bL[bL.length] = t;
                    }
                }
            }
            if (t.hasChildNodes()) {
                for (var i = 0; i < t.childNodes.length; i++) {
                    if (qX) {
                        return;
                    }
                    this.rk(t.childNodes[i]);
                }
            }
        },
        mA: function(T) {
            switch (lw) {
            case "uppercase":
                return T.toUpperCase();
                break;
            case "lowercase":
                return T.toLowerCase();
                break;
            case "size":
                return "<span id=\"eWebEditor_Temp_Span_FontSize\" style=\"font-size:" + nD + "\">" + T + "</span>";
                break;
            }
        },
        rv: function(bB) {
            var pp = A.F.createElement("span");
            var wy = A.F.createTextNode(bB);
            pp.appendChild(wy);
            this.nB(pp);
            return pp;
        },
        nB: function(t) {
            switch (lw) {
            case "size":
                t.style.fontSize = nD;
                break;
            case "face":
                t.style.fontName = nD;
                break;
            }
        },
        uo: function(t) {
            if (t.nodeType == 3) {
                return t;
            }
            if (t.hasChildNodes()) {
                for (var i = 0; i < t.childNodes.length; i++) {
                    var bE = this.uo(t.childNodes[i]);
                    if (bE) {
                        return bE;
                    }
                }
            }
            return null;
        },
        ur: function(t) {
            var bE;
            if (t.nodeType == 3) {
                bE = t;
            }
            if (t.hasChildNodes()) {
                for (var i = 0; i < t.childNodes.length; i++) {
                    var uk = this.ur(t.childNodes[i]);
                    if (uk) {
                        bE = uk;
                    }
                }
            }
            if (bE) {
                return bE;
            } else {
                return null;
            }
        }
    };
})();
var xL = {
    Execute: function(am) {
        var b = false;
        if (am == "justifyleft" || am == "justifycenter" || am == "justifyright") {
            if (I.ay() == "Control") {
                var aB = I.aX();
                try {
                    if (am == "justifycenter") {
                        aB.align = "";
                        aB.style.display = "block";
                        aB.style.margin = "0px auto";
                        aB.style.textAlign = s;
                    } else {
                        aB.align = am.substr(7);
                        aB.style.display = "";
                        aB.style.margin = "";
                        aB.style.textAlign = "";
                    }
                    b = true;
                } catch(e) {}
            }
        }
        if (!b) {
            var p = this.pj(["P", "DIV", "TD", "TH"]);
            if (p) {
                if (am == "justifyfull") {
                    p.style.textAlign = "";
                    p.style.textJustify = "inter-ideograph";
                } else {
                    p.style.textAlign = am.substr(7);
                    p.style.textJustify = "";
                }
            } else {
                A.F.execCommand(am, false, null);
            }
        }
    },
    pj: function(gp) {
        var t = null;
        if (I.ay() != "Control") {
            t = I.dm();
            if (t.tagName == "HTML") {
                return null;
            }
            while (gp.eB(t.tagName.toUpperCase()) < 0) {
                if (t.tagName.toUpperCase() == "BODY") {
                    t = null;
                    break;
                }
                t = t.parentNode;
            }
        }
        return t;
    }
};
var xK = new Object();
xK.Execute = function(am) {
    var kK = false;
    try {
        A.F.execCommand(am, false, null);
        kK = true;
    } catch(e) {}
    if (!kK) {
        alert(lang['MsgSafe' + am]);
    }
};
var xH = new Object();
xH.Execute = function() {
    var aA = window.frameElement;
    var me = parent.document.documentElement;
    var he = parent.document.body.style;
    var aU;
    if (!this.hZ) {
        if (O.ae) {
            parent.attachEvent('onresize', gA);
        } else {
            parent.addEventListener('resize', gA, true);
        }
        this.kk = C.gJ(parent);
        aU = aA;
        while ((aU = aU.parentNode)) {
            if (aU.nodeType == 1) {
                aU._ewebSavedStyles = C.lD(aU);
                aU.style.zIndex = 9998;
            }
        }
        he.overflow = 'hidden';
        he.width = '0px';
        he.height = '0px';
        this.ry = C.lD(aA);
        var eL = C.fK(parent);
        aA.style.position = "absolute";
        aA.offsetLeft;
        aA.style.zIndex = 9998;
        aA.style.left = "0px";
        aA.style.top = "0px";
        aA.style.width = eL.Width + "px";
        aA.style.height = eL.Height + "px";
        if (!O.ae) {
            aA.style.borderRight = aA.style.borderBottom = "9999px solid white";
            aA.style.backgroundColor = "white";
        }
        parent.scrollTo(0, 0);
        var gu = C.pl(parent, aA);
        if (gu.x != 0) {
            aA.style.left = ( - 1 * gu.x) + "px";
        }
        if (gu.y != 0) {
            aA.style.top = ( - 1 * gu.y) + "px";
        }
        this.hZ = true;
    } else {
        if (O.ae) {
            parent.detachEvent("onresize", gA);
        } else {
            parent.removeEventListener("resize", gA, true);
        }
        aU = aA;
        while ((aU = aU.parentNode)) {
            if (aU._ewebSavedStyles) {
                C.ln(aU, aU._ewebSavedStyles);
                aU._ewebSavedStyles = null;
            }
        }
        if (O.ae) {
            me.style.overflow = this.tK;
        }
        C.ln(aA, this.ry);
        parent.scrollTo(this.kk.X, this.kk.Y);
        this.hZ = false;
    }
    this.dP();
    if (A.av == "EDIT" && !O.ae) {
        A.iT();
    }
    A.Focus();
};
xH.dP = function() {
    var cu = cq.hN("other", "Maximize");
    for (var j = 0; j < cu.length; j++) {
        var t = cu[j];
        if (this.hZ) {
            t.cn = "on";
            t.className = "TB_Btn_Down";
        } else {
            t.cn = null;
            t.className = "TB_Btn";
        }
    }
};
function gA() {
    var eL = C.fK(parent);
    var aA = window.frameElement;
    aA.style.width = eL.Width + 'px';
    aA.style.height = eL.Height + 'px';
};
function su() {
    if (!fd()) {
        return;
    }
    if (!dz(true)) {
        return;
    }
    U.Capture("");
    window.setTimeout("ll()", 100);
};
function ll() {
    try {
        if (U.Status != "ok") {
            window.setTimeout("ll()", 100);
            return;
        }
    } catch(e) {
        return
    }
    if (U.Error == "cancel") {
        return;
    }
    if (ef()) {
        return;
    }
    var dF = U.Body;
    insertHTML(dF);
    U = null;
};
function xW() {
    if (config.AutoDetectPaste == "2") {
        window.setTimeout("xP()", 10);
        return;
    }
    try {
        A.F.execCommand("paste", false, null);
    } catch(e) {
        showDialog("pastegecko.htm");
    }
};
function py() {
    var f = pS();
    insertHTML(f);
};
function yk(an) {
    showDialog("pasteoption.htm?flag=" + an, true);
};
function xS() {
    showDialog("importword.htm?action=paste", true);
};
function yj() {
    showDialog("importexcel.htm?action=paste", true);
};
function xP() {
    A.Focus();
    xB.Save();
    if (O.ae) {
        var f = ej(clipboardData.getData("Text"));
        insertHTML(f);
    } else {
        showDialog("pastegecko.htm?action=text");
    }
    xB.Save();
    A.Focus();
};
function pS() {
    var fh = $("eWebEditor_Temp_HTML");
    fh.innerHTML = "";
    var kU = document.body.createTextRange();
    kU.moveToElementText(fh);
    kU.execCommand("Paste");
    var f = fh.innerHTML;
    fh.innerHTML = "";
    return f;
};
var xJ = {
    Execute: function() {
        this.fo();
        this.bJ = !this.bJ;
        this.dP();
    },
    iw: function() {
        this.fo();
        if (this.bJ) {
            this.dP();
        }
    },
    fo: function() {
        if (typeof(this.bJ) == "undefined") {
            this.bJ = (config.ShowBorder == "0") ? false: true;
        }
    },
    dP: function() {
        var K = A.F.getElementsByTagName("TABLE");
        for (var i = 0; i < K.length; i++) {
            var t = K[i];
            if (this.bJ) {
                t.className += ' ewebeditor__showtableborders';
            } else {
                t.className = t.className.replace(/(^| )ewebeditor__showtableborders/gi, '');
            }
        }
        var cu = cq.hN("other", "ShowBorders");
        for (var j = 0; j < cu.length; j++) {
            var t = cu[j];
            if (this.bJ) {
                t.cn = "on";
                t.className = "TB_Btn_Down";
            } else {
                t.cn = null;
                t.className = "TB_Btn";
            }
        }
    }
};
var xI = {
    Execute: function() {
        this.fo();
        this.bJ = !this.bJ;
        this.dP();
    },
    iw: function() {
        this.fo();
        if (this.bJ) {
            this.dP();
        }
    },
    fo: function() {
        if (typeof(this.bJ) == "undefined") {
            this.bJ = (config.ShowBlock == "1") ? true: false;
        }
    },
    dP: function() {
        var cA = A.F.body;
        if (this.bJ) {
            cA.className += ' ewebeditor__showblocks';
        } else {
            cA.className = cA.className.replace(/(^| )ewebeditor__showblocks/gi, '');
        }
        var cu = cq.hN("other", "ShowBlocks");
        for (var j = 0; j < cu.length; j++) {
            var t = cu[j];
            if (this.bJ) {
                t.cn = "on";
                t.className = "TB_Btn_Down";
            } else {
                t.cn = null;
                t.className = "TB_Btn";
            }
        }
    }
};
function ya(an) {
    if (!fd()) {
        return;
    }
    switch (an) {
    case "word":
        showDialog('importword.htm', true);
        break;
    case "excel":
        showDialog('importexcel.htm', true);
        break;
    }
};
var xG = {
    Insert: function(an) {
        switch (an) {
        case "inputtext":
            insertHTML('<input type="text">');
            break;
        case "textarea":
            insertHTML('<textarea></textarea>');
            break;
        case "radio":
            insertHTML('<input type="radio">');
            break;
        case "checkbox":
            insertHTML('<input type="checkbox">');
            break;
        case "select":
            insertHTML('<select></select>');
            break;
        case "button":
            insertHTML('<input type="button">');
            break;
        }
    }
};
function yi() {
    A.bi.print();
};
var C = new Object();
C.fj = function(document) {
    return ("CSS1Compat" == (document.compatMode || (O.hg ? "CSS1Compat": null)));
};
C.iv = function(V) {
    V.style.cssText = "margin:0;" + "padding:0;" + "border:0;" + "background-color:transparent;" + "background-image:none;";
};
C.dk = function(V) {
    return V.ownerDocument || V.document;
};
C.mi = function(V) {
    return this.pA(this.dk(V));
};
C.pA = function(document) {
    if (O.hg && !document.parentWindow) {
        this.kv(window.top);
    }
    return document.parentWindow || document.defaultView;
};
C.kv = function(dn) {
    if (dn.document) {
        dn.document.parentWindow = dn;
    }
    for (var i = 0; i < dn.frames.length; i++) {
        C.kv(dn.frames[i]);
    }
};
C.nA = function() {
    var dj = window.parent;
    while (dj.parent && dj.parent != dj) {
        try {
            if (dj.parent.document.domain != document.domain) {
                break;
            }
            if (dj.parent.document.getElementsByTagName("frameset").length > 0) {
                break;
            }
        } catch(e) {
            break;
        }
        dj = dj.parent;
    }
    return dj;
};
C.gG = function(w, node) {
    var x = 0;
    var y = 0;
    var bf = node;
    var iF = null;
    var gg = C.mi(bf);
    while (bf && !(gg == w && (bf == w.document.body || bf == w.document.documentElement))) {
        x += bf.offsetLeft - bf.scrollLeft;
        y += bf.offsetTop - bf.scrollTop;
        if (!O.hW) {
            var eb = iF;
            while (eb && eb != bf) {
                x -= eb.scrollLeft;
                y -= eb.scrollTop;
                eb = eb.parentNode;
            }
        }
        iF = bf;
        if (bf.offsetParent) {
            bf = bf.offsetParent;
        } else {
            if (gg != w) {
                bf = gg.frameElement;
                iF = null;
                if (bf) {
                    gg = bf.contentWindow.parent;
                }
            } else {
                bf = null;
            }
        }
    }
    if (C.cG(w.document.body, 'position') != 'static' || (O.ae && C.po(node) == null)) {
        x += w.document.body.offsetLeft;
        y += w.document.body.offsetTop;
    }
    return {
        "x": x,
        "y": y
    };
};
C.pl = function(w, node) {
    var pos = this.gG(w, node);
    var scroll = C.gJ(w);
    pos.x -= scroll.X;
    pos.y -= scroll.Y;
    return pos;
};
C.vW = function(V, qu) {
    var window = this.mi(V);
    var kH = this.fK(window).Height;
    var offset = kH * -1;
    if (qu === false) {
        offset += V.offsetHeight || 0;
        offset += parseInt(this.cG(V, 'marginBottom') || 0, 10) || 0;
    }
    var qd = this.gG(window, V);
    offset += qd.y;
    var kw = this.gJ(window).Y;
    if (offset > 0 && (offset > kw || offset < kw - kH)) {
        window.scrollTo(0, offset);
    }
};
C.ls = function(bQ) {
    if (!bQ || bQ.nodeType != 1 || bQ.tagName.toLowerCase() != 'form') {
        return [];
    }
    var dD = [];
    var ko = ['style', 'className'];
    for (var i = 0; i < ko.length; i++) {
        var name = ko[i];
        if (bQ.elements.namedItem(name)) {
            var hM = bQ.elements.namedItem(name);
            dD.push([hM, hM.nextSibling]);
            bQ.removeChild(hM);
        }
    }
    return dD;
};
C.lm = function(bQ, dD) {
    if (!bQ || bQ.nodeType != 1 || bQ.tagName.toLowerCase() != 'form') {
        return;
    }
    if (dD.length > 0) {
        for (var i = dD.length - 1; i >= 0; i--) {
            var node = dD[i][0];
            var mu = dD[i][1];
            if (mu) {
                bQ.insertBefore(node, mu);
            } else {
                bQ.appendChild(node);
            }
        }
    }
};
C.po = function(V) {
    var cI = V;
    while (cI != C.dk(cI).documentElement) {
        if (this.cG(cI, 'position') != 'static') {
            return cI;
        }
        if (cI == C.dk(cI).documentElement && qU != w) {
            cI = qU.frameElement;
        } else {
            cI = cI.parentNode;
        }
    }
    return null;
};
C.mo = function(eP, rw, gx, gr, iq) {
    return (iq || window).setTimeout(function() {
        if (gr) {
            eP.apply(gx, [].concat(gr));
        } else {
            eP.apply(gx);
        }
    },
    rw);
};
C.vT = function(eP, gx, gr, iq) {
    if (eP) {
        this.mo(eP, 0, gx, gr, iq);
    }
};
C.dW = function(V, kg) {
    var style = V.style;
    for (var km in kg) {
        style[km] = kg[km];
    }
};
C.cW = function(node, qt) {
    if (qt) {
        var kx;
        while ((kx = node.firstChild)) {
            node.parentNode.insertBefore(node.removeChild(kx), node);
        }
    }
    return node.parentNode.removeChild(node);
};
C.lk = function(dn) {
    dn.$ = function(id) {
        return dn.document.getElementById(id);
    };
};
C.iH = function() {
    return "javascript: void(0);";
};
C.aR = function(e) {
    if (e) {
        e.preventDefault();
        e.stopPropagation();
    }
};
C.ao = function(hL, is, hO) {
    hL.addEventListener(is, hO, false);
};
C.lo = function(hL, is, hO) {
    hL.removeEventListener(is, hO, false);
};
C.fK = function(kL) {
    return {
        Width: kL.innerWidth,
        Height: kL.innerHeight
    };
};
C.gJ = function(mI) {
    return {
        X: mI.pageXOffset,
        Y: mI.pageYOffset
    };
};
C.oC = function(V, opacity) {
    V.style.opacity = opacity;
};
C.cG = function(V, propertyName) {
    return V.ownerDocument.defaultView.getComputedStyle(V, "").getPropertyValue(propertyName);
};
C.DisableSelection = function(V) {
    if (O.jx) {
        V.style.MozUserSelect = '-moz-none';
    } else if (O.hg) {
        V.style.KhtmlUserSelect = 'none';
    } else {
        V.style.userSelect = 'none';
    }
    var K = V.getElementsByTagName("*");
    for (var i = 0; i < K.length; i++) {
        switch (K[i].tagName) {
        case "INPUT":
        case "TEXTAREA":
            K[i].style.MozUserSelect = "text";
            break;
        default:
        }
    }
};
C.lD = function(V) {
    var data = C.ls(V);
    var iD = new Object();
    if (V.className.length > 0) {
        iD.qw = V.className;
        V.className = '';
    }
    var jk = V.getAttribute('style');
    if (jk && jk.length > 0) {
        iD.Inline = jk;
        V.setAttribute('style', '', 0);
    }
    C.lm(V, data);
    return iD;
};
C.ln = function(V, ja) {
    var data = C.ls(V);
    V.className = ja.qw || '';
    if (ja.Inline) {
        V.setAttribute('style', ja.Inline, 0);
    } else {
        V.removeAttribute('style', 0);
    }
    C.lm(V, data);
};
var I = new Object();
I.ay = function() {
    var type = 'Text';
    var uX = {
        img: 1,
        hr: 1,
        li: 1,
        table: 1,
        tr: 1,
        td: 1,
        embed: 1,
        object: 1,
        ol: 1,
        ul: 1
    };
    var bu;
    try {
        bu = this.bH();
    } catch(e) {}
    if (bu && bu.rangeCount == 1) {
        var bd = bu.getRangeAt(0);
        if (bd.startContainer == bd.endContainer && (bd.endOffset - bd.startOffset) == 1 && bd.startContainer.nodeType == 1 && uX[bd.startContainer.childNodes[bd.startOffset].nodeName.toLowerCase()]) {
            type = 'Control';
        }
    }
    return type;
};
I.aX = function() {
    var selection = !!A.bi && this.bH();
    if (!selection || selection.rangeCount < 1) {
        return null;
    }
    var bd = selection.getRangeAt(0);
    if (bd.startContainer != bd.endContainer || bd.startContainer.nodeType != 1 || bd.startOffset != bd.endOffset - 1) {
        return null;
    }
    var node = bd.startContainer.childNodes[bd.startOffset];
    if (node.nodeType != 1) {
        return null;
    }
    return node;
};
I.dm = function() {
    if (this.ay() == 'Control') {
        return I.aX().parentNode;
    } else {
        var aC = this.bH();
        if (aC) {
            var oRange = aC.getRangeAt(0);
            if (aC.anchorNode && aC.anchorNode == aC.focusNode) {
                if (oRange.collapsed || oRange.startContainer.nodeType == 3) {
                    return aC.anchorNode.parentNode;
                } else {
                    return aC.anchorNode;
                }
            }
            return oRange.commonAncestorContainer;
        }
    }
    return null;
};
I.wi = function(mQ) {
    if (!A.bi) {
        return null;
    }
    if (this.ay() == 'Control') {
        return I.aX().parentNode;
    } else {
        var aC = this.bH();
        if (aC && aC.rangeCount > 0) {
            var bd = aC.getRangeAt(mQ ? 0 : (aC.rangeCount - 1));
            var V = mQ ? bd.startContainer: bd.endContainer;
            return (V.nodeType == 1 ? V: V.parentNode);
        }
    }
    return null;
};
I.tI = function(V) {
    var oRange = A.F.createRange();
    oRange.selectNode(V);
    var aC = this.bH();
    aC.removeAllRanges();
    aC.addRange(oRange);
};
I.Collapse = function(lb) {
    var aC = this.bH();
    if (lb == null || lb === true) {
        aC.collapseToStart();
    } else {
        aC.collapseToEnd();
    }
};
I.wA = function(iu) {
    var ca = this.aX();
    if (!ca && A.bi) {
        try {
            ca = this.bH().getRangeAt(0).startContainer;
        } catch(e) {}
    }
    while (ca) {
        if (ca.nodeType == 1 && ca.nodeName.tz(iu)) return true;
        ca = ca.parentNode;
    }
    return false;
};
I.vN = function(iu) {
    var hj;
    var ca = this.aX();
    if (!ca) {
        ca = this.bH().getRangeAt(0).startContainer;
    }
    while (ca) {
        if (ca.nodeName.tz(iu)) {
            return ca;
        }
        ca = ca.parentNode;
    }
    return null;
};
I.Delete = function() {
    var aC = this.bH();
    for (var i = 0; i < aC.rangeCount; i++) {
        aC.getRangeAt(i).deleteContents();
    }
    return aC;
};
I.bH = function() {
    return A.bi.getSelection();
};
I.Save = function() {};
I.eF = function() {};
I.nz = function() {};
function cleanAndPaste(html) {
    html = html.replace(/<\/?SPAN[^>]*>/gi, "");
    html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
    html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3");
    html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
    html = html.replace(/<\\?\?xml[^>]*>/gi, "");
    html = html.replace(/<\/?\w+:[^>]*>/gi, "");
    html = html.replace(/&nbsp;/, " ");
    insertHTML(html);
}
function GetClipboardHTML() {
    var oDiv = document.getElementById("eWebEditor_Temp_HTML");
    oDiv.innerHTML = "";
    var oTextRange = document.body.createTextRange();
    oTextRange.moveToElementText(oDiv);
    oTextRange.execCommand("Paste");
    var sData = oDiv.innerHTML;
    oDiv.innerHTML = "";
    return sData;
}
//常规粘贴
